]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Move combine over to statistics_counter_event.
authorAndrew Pinski <apinski@marvell.com>
Sat, 21 Sep 2019 01:27:34 +0000 (01:27 +0000)
committerAndrew Pinski <apinski@marvell.com>
Thu, 20 Jul 2023 15:56:42 +0000 (08:56 -0700)
Since we have statistics_counter_event now, combine should use that
instead of it is own custom printing of statistics.
The only thing that is not done any more after this patch is printing
out the total stats for the whole TU.

Note you need to use -fdump-rtl-combine-stats to get the stats in the combine
dump unlike before where the stats was dumped directly into the file.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

* combine.cc (dump_combine_stats): Remove.
(dump_combine_total_stats): Remove.
(total_attempts, total_merges, total_extras,
total_successes): Remove.
(combine_instructions): Don't increment total stats
instead use statistics_counter_event.
* dumpfile.cc (print_combine_total_stats): Remove.
* dumpfile.h (print_combine_total_stats): Remove.
(dump_combine_total_stats): Remove.
* passes.cc (finish_optimization_passes):
Don't call print_combine_total_stats.
* rtl.h (dump_combine_total_stats): Remove.
(dump_combine_stats): Remove.

gcc/combine.cc
gcc/dumpfile.cc
gcc/dumpfile.h
gcc/passes.cc
gcc/rtl.h

index d9161b257e8257a483bf74ae110f19f9a8ade3ae..4bf867d74b05fbeb88df757654471e113947fe74 100644 (file)
@@ -108,10 +108,6 @@ static int combine_extras;
 
 static int combine_successes;
 
-/* Totals over entire compilation.  */
-
-static int total_attempts, total_merges, total_extras, total_successes;
-
 /* combine_instructions may try to replace the right hand side of the
    second instruction with the value of an associated REG_EQUAL note
    before throwing it at try_combine.  That is problematic when there
@@ -1456,10 +1452,10 @@ retry:
     undobuf.frees = 0;
   }
 
-  total_attempts += combine_attempts;
-  total_merges += combine_merges;
-  total_extras += combine_extras;
-  total_successes += combine_successes;
+  statistics_counter_event (cfun, "attempts", combine_attempts);
+  statistics_counter_event (cfun, "merges", combine_merges);
+  statistics_counter_event (cfun, "extras", combine_extras);
+  statistics_counter_event (cfun, "successes", combine_successes);
 
   nonzero_sign_valid = 0;
   rtl_hooks = general_rtl_hooks;
@@ -14936,24 +14932,6 @@ unmentioned_reg_p (rtx equiv, rtx expr)
   return false;
 }
 \f
-DEBUG_FUNCTION void
-dump_combine_stats (FILE *file)
-{
-  fprintf
-    (file,
-     ";; Combiner statistics: %d attempts, %d substitutions (%d requiring new space),\n;; %d successes.\n\n",
-     combine_attempts, combine_merges, combine_extras, combine_successes);
-}
-
-void
-dump_combine_total_stats (FILE *file)
-{
-  fprintf
-    (file,
-     "\n;; Combiner totals: %d attempts, %d substitutions (%d requiring new space),\n;; %d successes.\n",
-     total_attempts, total_merges, total_extras, total_successes);
-}
-\f
 /* Make pseudo-to-pseudo copies after every hard-reg-to-pseudo-copy, because
    the reg-to-reg copy can usefully combine with later instructions, but we
    do not want to combine the hard reg into later instructions, for that
index 51f68c8c6b40051ba3125c84298ee44ca52f5d17..a2050d1300902d854bbc6acdd7c68142cedbf7ae 100644 (file)
@@ -2074,15 +2074,6 @@ dump_function (int phase, tree fn)
     }
 }
 
-/* Print information from the combine pass on dump_file.  */
-
-void
-print_combine_total_stats (void)
-{
-  if (dump_file)
-    dump_combine_total_stats (dump_file);
-}
-
 /* Enable RTL dump for all the RTL passes.  */
 
 bool
index 7d5eca899dcc98676a9ce7a7efff8e439854ff89..c41940624ca365faf0f11b039ab2c4a2b3830fb0 100644 (file)
@@ -647,14 +647,11 @@ class auto_dump_scope
   auto_dump_scope scope (NAME, USER_LOC)
 
 extern void dump_function (int phase, tree fn);
-extern void print_combine_total_stats (void);
 extern bool enable_rtl_dump_file (void);
 
 /* In tree-dump.cc  */
 extern void dump_node (const_tree, dump_flags_t, FILE *);
 
-/* In combine.cc  */
-extern void dump_combine_total_stats (FILE *);
 /* In cfghooks.cc  */
 extern void dump_bb (FILE *, basic_block, int, dump_flags_t);
 
index d7b0ad271a1997a5da2cd324b2b343a680fa42d0..6f894a41d22544507f7673950b4a9aa64a2548a3 100644 (file)
@@ -359,13 +359,6 @@ finish_optimization_passes (void)
       dumps->dump_finish (pass_profile_1->static_pass_number);
     }
 
-  if (optimize > 0)
-    {
-      dumps->dump_start (pass_combine_1->static_pass_number, NULL);
-      print_combine_total_stats ();
-      dumps->dump_finish (pass_combine_1->static_pass_number);
-    }
-
   /* Do whatever is necessary to finish printing the graphs.  */
   for (i = TDI_end; (dfi = dumps->get_dump_file_info (i)) != NULL; ++i)
     if (dfi->graph_dump_initialized)
index 098dc4ccc1c764f17d0d3032615706ff0ba3aa68..03b7d058295361f66bc78e7c1c952a9fcb5c9307 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -4216,8 +4216,6 @@ extern bool validate_subreg (machine_mode, machine_mode,
 /* In combine.cc  */
 extern unsigned int extended_count (const_rtx, machine_mode, int);
 extern rtx remove_death (unsigned int, rtx_insn *);
-extern void dump_combine_stats (FILE *);
-extern void dump_combine_total_stats (FILE *);
 extern rtx make_compound_operation (rtx, enum rtx_code);
 
 /* In sched-rgn.cc.  */