IPA: reduce what we dump in normal mode

Message ID 6a2508ac-9673-c759-c0a1-bd78a67105f6@suse.cz
State New, archived
Headers
Series IPA: reduce what we dump in normal mode |

Commit Message

Martin Liška Aug. 2, 2022, 8:46 a.m. UTC
  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(-)
  

Comments

Richard Biener Aug. 2, 2022, 9:52 a.m. UTC | #1
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
>
  
Jan Hubicka Aug. 2, 2022, 4:27 p.m. UTC | #2
> 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
>
  
Martin Liška Aug. 3, 2022, 8:56 a.m. UTC | #3
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
  

Patch

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)