public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] IPA: reduce what we dump in normal mode
@ 2022-08-02  8:46 Martin Liška
  2022-08-02  9:52 ` Richard Biener
  2022-08-02 16:27 ` Jan Hubicka
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Liška @ 2022-08-02  8:46 UTC (permalink / raw)
  To: gcc-patches; +Cc: Martin Jambor, Jan Hubicka

gcc/ChangeLog:

	* profile.cc (compute_branch_probabilities): Dump details only
	if TDF_DETAILS.
	* symtab.cc (symtab_node::dump_base): Do not dump pointer unless
	TDF_ADDRESS is used, it makes comparison harder.
---
 gcc/profile.cc | 2 +-
 gcc/symtab.cc  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/profile.cc b/gcc/profile.cc
index 08af512cbca..92de821b8bb 100644
--- a/gcc/profile.cc
+++ b/gcc/profile.cc
@@ -766,7 +766,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
 	      sum2 += freq2;
 	    }
 	}
-      if (dump_file)
+      if (dump_file && (dump_flags & TDF_DETAILS))
 	{
 	  double nsum1 = 0, nsum2 = 0;
 	  stats.qsort (cmp_stats);
diff --git a/gcc/symtab.cc b/gcc/symtab.cc
index 8670337416e..f2d96c0268b 100644
--- a/gcc/symtab.cc
+++ b/gcc/symtab.cc
@@ -894,7 +894,8 @@ symtab_node::dump_base (FILE *f)
   };
 
   fprintf (f, "%s (%s)", dump_asm_name (), name ());
-  dump_addr (f, " @", (void *)this);
+  if (dump_flags & TDF_ADDRESS)
+    dump_addr (f, " @", (void *)this);
   fprintf (f, "\n  Type: %s", symtab_type_names[type]);
 
   if (definition)
-- 
2.37.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] IPA: reduce what we dump in normal mode
  2022-08-02  8:46 [PATCH] IPA: reduce what we dump in normal mode Martin Liška
@ 2022-08-02  9:52 ` Richard Biener
  2022-08-02 16:27 ` Jan Hubicka
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Biener @ 2022-08-02  9:52 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches, Jan Hubicka

On Tue, Aug 2, 2022 at 10:46 AM Martin Liška <mliska@suse.cz> wrote:

OK

> gcc/ChangeLog:
>
>         * profile.cc (compute_branch_probabilities): Dump details only
>         if TDF_DETAILS.
>         * symtab.cc (symtab_node::dump_base): Do not dump pointer unless
>         TDF_ADDRESS is used, it makes comparison harder.
> ---
>  gcc/profile.cc | 2 +-
>  gcc/symtab.cc  | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/profile.cc b/gcc/profile.cc
> index 08af512cbca..92de821b8bb 100644
> --- a/gcc/profile.cc
> +++ b/gcc/profile.cc
> @@ -766,7 +766,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
>               sum2 += freq2;
>             }
>         }
> -      if (dump_file)
> +      if (dump_file && (dump_flags & TDF_DETAILS))
>         {
>           double nsum1 = 0, nsum2 = 0;
>           stats.qsort (cmp_stats);
> diff --git a/gcc/symtab.cc b/gcc/symtab.cc
> index 8670337416e..f2d96c0268b 100644
> --- a/gcc/symtab.cc
> +++ b/gcc/symtab.cc
> @@ -894,7 +894,8 @@ symtab_node::dump_base (FILE *f)
>    };
>
>    fprintf (f, "%s (%s)", dump_asm_name (), name ());
> -  dump_addr (f, " @", (void *)this);
> +  if (dump_flags & TDF_ADDRESS)
> +    dump_addr (f, " @", (void *)this);
>    fprintf (f, "\n  Type: %s", symtab_type_names[type]);
>
>    if (definition)
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] IPA: reduce what we dump in normal mode
  2022-08-02  8:46 [PATCH] IPA: reduce what we dump in normal mode Martin Liška
  2022-08-02  9:52 ` Richard Biener
@ 2022-08-02 16:27 ` Jan Hubicka
  2022-08-03  8:56   ` Martin Liška
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Hubicka @ 2022-08-02 16:27 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches, Martin Jambor

> gcc/ChangeLog:
> 
> 	* profile.cc (compute_branch_probabilities): Dump details only
> 	if TDF_DETAILS.
> 	* symtab.cc (symtab_node::dump_base): Do not dump pointer unless
> 	TDF_ADDRESS is used, it makes comparison harder.
> ---
>  gcc/profile.cc | 2 +-
>  gcc/symtab.cc  | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/profile.cc b/gcc/profile.cc
> index 08af512cbca..92de821b8bb 100644
> --- a/gcc/profile.cc
> +++ b/gcc/profile.cc
> @@ -766,7 +766,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
>  	      sum2 += freq2;
>  	    }
>  	}
> -      if (dump_file)
> +      if (dump_file && (dump_flags & TDF_DETAILS))
If you disable dumping, you can also disable the collection of stats
which is guarded by if (dump_file) as well.  Otherwise the patch is OK.
>  	{
>  	  double nsum1 = 0, nsum2 = 0;
>  	  stats.qsort (cmp_stats);
> diff --git a/gcc/symtab.cc b/gcc/symtab.cc
> index 8670337416e..f2d96c0268b 100644
> --- a/gcc/symtab.cc
> +++ b/gcc/symtab.cc
> @@ -894,7 +894,8 @@ symtab_node::dump_base (FILE *f)
>    };
>  
>    fprintf (f, "%s (%s)", dump_asm_name (), name ());
> -  dump_addr (f, " @", (void *)this);
> +  if (dump_flags & TDF_ADDRESS)
> +    dump_addr (f, " @", (void *)this);
>    fprintf (f, "\n  Type: %s", symtab_type_names[type]);
>  
>    if (definition)
> -- 
> 2.37.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] IPA: reduce what we dump in normal mode
  2022-08-02 16:27 ` Jan Hubicka
@ 2022-08-03  8:56   ` Martin Liška
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liška @ 2022-08-03  8:56 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches, Martin Jambor

[-- Attachment #1: Type: text/plain, Size: 249 bytes --]

On 8/2/22 18:27, Jan Hubicka wrote:
> If you disable dumping, you can also disable the collection of stats
> which is guarded by if (dump_file) as well.  Otherwise the patch is OK.

Sure, good point!

I'm going to push the following.

Thanks,
Martin

[-- Attachment #2: 0001-profile-do-not-collect-stats-unless-TDF_DETAILS.patch --]
[-- Type: text/x-patch, Size: 1486 bytes --]

From 7585e5ecb47761516b8f397002819f2c95b8c32e Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Wed, 3 Aug 2022 10:53:22 +0200
Subject: [PATCH] profile: do not collect stats unless TDF_DETAILS

gcc/ChangeLog:

	* profile.cc (compute_branch_probabilities): Do not collect
	stats unless TDF_DETAILS.
---
 gcc/profile.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/profile.cc b/gcc/profile.cc
index 92de821b8bb..96121d60711 100644
--- a/gcc/profile.cc
+++ b/gcc/profile.cc
@@ -753,7 +753,8 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
 	    bb->count = profile_count::from_gcov_type (bb_gcov_count (bb));
 	  else
 	    bb->count = profile_count::guessed_zero ();
-	  if (dump_file && bb->index >= 0)
+
+	  if (dump_file && (dump_flags & TDF_DETAILS) && bb->index >= 0)
 	    {
 	      double freq1 = cnt.to_sreal_scale (old_entry_cnt).to_double ();
 	      double freq2 = bb->count.to_sreal_scale
@@ -776,8 +777,8 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
 	      nsum2 += stat.feedback;
 	      fprintf (dump_file,
 		       " Basic block %4i guessed freq: %12.3f"
-		       " cummulative:%6.2f%% "
-		       " feedback freq: %12.3f cummulative:%7.2f%%"
+		       " cumulative:%6.2f%% "
+		       " feedback freq: %12.3f cumulative:%7.2f%%"
 		       " cnt: 10%" PRId64 "\n", stat.bb->index,
 		       stat.guessed,
 		       nsum1 * 100 / sum1,
-- 
2.37.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-03  8:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02  8:46 [PATCH] IPA: reduce what we dump in normal mode Martin Liška
2022-08-02  9:52 ` Richard Biener
2022-08-02 16:27 ` Jan Hubicka
2022-08-03  8:56   ` Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).