tree-ssa-reassoc.c (fini_reassoc): Use the statistics infrastructure.
authorRichard Guenther <rguenther@suse.de>
Tue, 20 May 2008 12:34:06 +0000 (12:34 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 20 May 2008 12:34:06 +0000 (12:34 +0000)
2008-05-20  Richard Guenther  <rguenther@suse.de>

* tree-ssa-reassoc.c (fini_reassoc): Use the statistics
infrastructure.
* tree-ssa-sccvn.c (process_scc): Likewise.
* tree-ssa-sink.c (execute_sink_code): Likewise.
* tree-ssa-threadupdate.c (thread_through_all_blocks): Likewise.
* tree-vrp.c (process_assert_insertions): Likewise.
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Likewise.
(perform_tree_ssa_dce): Likewise.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise.
(dump_dominator_optimization_stats): Likewise.
* tree-vectorizer.c (vectorize_loops): Likewise.

* gcc.dg/tree-ssa/ssa-sink-1.c: Adjust.
* gcc.dg/tree-ssa/ssa-sink-2.c: Likewise.
* gcc.dg/tree-ssa/ssa-sink-3.c: Likewise.
* gcc.dg/tree-ssa/ssa-sink-4.c: Likewise.

From-SVN: r135611

14 files changed:
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-1.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-2.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-3.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-4.c
gcc/tree-ssa-dce.c
gcc/tree-ssa-dom.c
gcc/tree-ssa-reassoc.c
gcc/tree-ssa-sccvn.c
gcc/tree-ssa-sink.c
gcc/tree-ssa-threadupdate.c
gcc/tree-vectorizer.c
gcc/tree-vrp.c

index fc28f21667e71778c4e9d45fcb21b65f7a78f9be..9d9bc21a7ad1a5f441b0e948466b7b7b2145a75d 100644 (file)
@@ -1,3 +1,17 @@
+2008-05-20  Richard Guenther  <rguenther@suse.de>
+
+       * tree-ssa-reassoc.c (fini_reassoc): Use the statistics
+       infrastructure.
+       * tree-ssa-sccvn.c (process_scc): Likewise.
+       * tree-ssa-sink.c (execute_sink_code): Likewise.
+       * tree-ssa-threadupdate.c (thread_through_all_blocks): Likewise.
+       * tree-vrp.c (process_assert_insertions): Likewise.
+       * tree-ssa-dce.c (eliminate_unnecessary_stmts): Likewise.
+       (perform_tree_ssa_dce): Likewise.
+       * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise.
+       (dump_dominator_optimization_stats): Likewise.
+       * tree-vectorizer.c (vectorize_loops): Likewise.
+
 2008-05-20  Richard Guenther  <rguenther@suse.de>
 
        * tree-vn.c (vn_lookup_with_vuses): Do not use the alias oracle.
index 9e861884b5394f55f48792b2825839ba04d8b25b..ffbddf63f427a1e42b4d40e2fb1cace3d7ef0b0f 100644 (file)
@@ -1,3 +1,10 @@
+2008-05-20  Richard Guenther  <rguenther@suse.de>
+
+       * gcc.dg/tree-ssa/ssa-sink-1.c: Adjust.
+       * gcc.dg/tree-ssa/ssa-sink-2.c: Likewise.
+       * gcc.dg/tree-ssa/ssa-sink-3.c: Likewise.
+       * gcc.dg/tree-ssa/ssa-sink-4.c: Likewise.
+
 2008-05-20  Sandra Loosemore  <sandra@codesourcery.com>
 
        * gcc.c-torture/compile/20061214-1.c: New test.
index 4dc415d438e235d1d8de07f0e8d50801c88273b1..c3326d27e25d4bb73b6394afbfba61118a143307 100644 (file)
@@ -7,5 +7,5 @@ foo (int a, int b, int c)
   return c ? x : a;
 }
 /* We should sink the x = a * b calculation into the branch that returns x. */
-/* { dg-final { scan-tree-dump-times "Sunk statements:1" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */
 /* { dg-final { cleanup-tree-dump "sink" } } */
index 259a11a34d14ea4e17c8528916e9071b84336774..1d54d019e7fbb2c512e61e701c63082a1a0cc010 100644 (file)
@@ -9,5 +9,5 @@ bar (int a, int b, int c)
   return y;
 }
 /* We should sink the x = a * b calculation into the else branch  */
-/* { dg-final { scan-tree-dump-times "Sunk statements:1" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */
 /* { dg-final { cleanup-tree-dump "sink" } } */
index 50efa339f5e3595f34521108daa032c8002f9ce8..fceb509e8bc2999e4f746b76754e2ec715bcbdb4 100644 (file)
@@ -12,5 +12,5 @@ main (int argc)
     }
 }
 /* We should sink the a = argc + 1 calculation into the if branch  */
-/* { dg-final { scan-tree-dump-times "Sunk statements:1" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */
 /* { dg-final { cleanup-tree-dump "sink" } } */
index c49c4f8d00647963fd2301c65d4fe4244855fa0f..6e1cc50dc1107b63d0696295ac55afa25e53e5e6 100644 (file)
@@ -17,5 +17,5 @@ main (int argc)
   foo2 (a);
 }
 /* We should sink the first a = b + c calculation into the else branch  */
-/* { dg-final { scan-tree-dump-times "Sunk statements:1" 1 "sink" } } */
+/* { dg-final { scan-tree-dump-times "Sunk statements: 1" 1 "sink" } } */
 /* { dg-final { cleanup-tree-dump "sink" } } */
index 95457eb7fe423de8cf0578963f9556933a4617f4..760e20d14bc36a9181bc150134c7cce9a5ab192d 100644 (file)
@@ -735,22 +735,19 @@ eliminate_unnecessary_stmts (void)
 static void
 print_stats (void)
 {
-  if (dump_file && (dump_flags & (TDF_STATS|TDF_DETAILS)))
-    {
-      float percg;
+  float percg;
 
-      percg = ((float) stats.removed / (float) stats.total) * 100;
-      fprintf (dump_file, "Removed %d of %d statements (%d%%)\n",
-              stats.removed, stats.total, (int) percg);
+  percg = ((float) stats.removed / (float) stats.total) * 100;
+  fprintf (dump_file, "Removed %d of %d statements (%d%%)\n",
+          stats.removed, stats.total, (int) percg);
 
-      if (stats.total_phis == 0)
-       percg = 0;
-      else
-       percg = ((float) stats.removed_phis / (float) stats.total_phis) * 100;
+  if (stats.total_phis == 0)
+    percg = 0;
+  else
+    percg = ((float) stats.removed_phis / (float) stats.total_phis) * 100;
 
-      fprintf (dump_file, "Removed %d of %d PHI nodes (%d%%)\n",
-              stats.removed_phis, stats.total_phis, (int) percg);
-    }
+  fprintf (dump_file, "Removed %d of %d PHI nodes (%d%%)\n",
+          stats.removed_phis, stats.total_phis, (int) percg);
 }
 \f
 /* Initialization for this pass.  Set up the used data structures.  */
@@ -854,8 +851,11 @@ perform_tree_ssa_dce (bool aggressive)
   if (cfg_altered)
     free_dominance_info (CDI_DOMINATORS);
 
+  statistics_counter_event (cfun, "Statements deleted", stats.removed);
+  statistics_counter_event (cfun, "PHI nodes deleted", stats.removed_phis);
+
   /* Debugging dumps.  */
-  if (dump_file)
+  if (dump_file && (dump_flags & (TDF_STATS|TDF_DETAILS)))
     print_stats ();
 
   tree_dce_done (aggressive);
index c4145b30ec26618977687965dcf7e925b641de54..255f24b98e719560d77786677d22a6c5c8ff7b9f 100644 (file)
@@ -357,6 +357,13 @@ tree_ssa_dominator_optimize (void)
        SSA_NAME_VALUE (name) = NULL;
     }
 
+  statistics_counter_event (cfun, "Redundant expressions eliminated",
+                           opt_stats.num_re);
+  statistics_counter_event (cfun, "Constants propagated",
+                           opt_stats.num_const_prop);
+  statistics_counter_event (cfun, "Copies propagated",
+                           opt_stats.num_copy_prop);
+
   /* Debugging dumps.  */
   if (dump_file && (dump_flags & TDF_STATS))
     dump_dominator_optimization_stats (dump_file);
@@ -868,25 +875,11 @@ record_equivalences_from_incoming_edge (basic_block bb)
 void
 dump_dominator_optimization_stats (FILE *file)
 {
-  long n_exprs;
-
   fprintf (file, "Total number of statements:                   %6ld\n\n",
           opt_stats.num_stmts);
   fprintf (file, "Exprs considered for dominator optimizations: %6ld\n",
            opt_stats.num_exprs_considered);
 
-  n_exprs = opt_stats.num_exprs_considered;
-  if (n_exprs == 0)
-    n_exprs = 1;
-
-  fprintf (file, "    Redundant expressions eliminated:         %6ld (%.0f%%)\n",
-          opt_stats.num_re, PERCENT (opt_stats.num_re,
-                                     n_exprs));
-  fprintf (file, "    Constants propagated:                     %6ld\n",
-          opt_stats.num_const_prop);
-  fprintf (file, "    Copies propagated:                        %6ld\n",
-          opt_stats.num_copy_prop);
-
   fprintf (file, "\nHash table statistics:\n");
 
   fprintf (file, "    avail_exprs: ");
index 19e10398168b7e2910c5fa35cca220b09951ac5b..5fcaa7bbb168ddd3f36b626ec3f4fd0bd1686227 100644 (file)
@@ -1487,18 +1487,14 @@ init_reassoc (void)
 static void
 fini_reassoc (void)
 {
-  if (dump_file && (dump_flags & TDF_STATS))
-    {
-      fprintf (dump_file, "Reassociation stats:\n");
-      fprintf (dump_file, "Linearized: %d\n", 
-              reassociate_stats.linearized);
-      fprintf (dump_file, "Constants eliminated: %d\n",
-              reassociate_stats.constants_eliminated);
-      fprintf (dump_file, "Ops eliminated: %d\n",
-              reassociate_stats.ops_eliminated);
-      fprintf (dump_file, "Statements rewritten: %d\n",
-              reassociate_stats.rewritten);
-    }
+  statistics_counter_event (cfun, "Linearized",
+                           reassociate_stats.linearized);
+  statistics_counter_event (cfun, "Constants eliminated",
+                           reassociate_stats.constants_eliminated);
+  statistics_counter_event (cfun, "Ops eliminated",
+                           reassociate_stats.ops_eliminated);
+  statistics_counter_event (cfun, "Statements rewritten",
+                           reassociate_stats.rewritten);
 
   pointer_map_destroy (operand_rank);
   free_alloc_pool (operand_entry_pool);
index 0b20a4ebc72a23e45f333bdbd329a78ca10ecda3..2bc9cb2e3ef27c48ec967bdcf9c6b6f20bf082be 100644 (file)
@@ -1947,9 +1947,7 @@ process_scc (VEC (tree, heap) *scc)
            changed |= visit_use (var);
        }
 
-      if (dump_file && (dump_flags & TDF_STATS))
-       fprintf (dump_file, "Processing SCC required %d iterations\n",
-                iterations);
+      statistics_histogram_event (cfun, "SCC iterations", iterations);
 
       /* Finally, visit the SCC once using the valid table.  */
       current_info = valid_info;
index 40a3640b7368575f7f3f0ac91da1635574c4084f..8945a6126634d146b519ea0ef0df5c629e1f03cc 100644 (file)
@@ -546,8 +546,7 @@ execute_sink_code (void)
   calculate_dominance_info (CDI_DOMINATORS);
   calculate_dominance_info (CDI_POST_DOMINATORS);
   sink_code_in_bb (EXIT_BLOCK_PTR); 
-  if (dump_file && (dump_flags & TDF_STATS))
-    fprintf (dump_file, "Sunk statements:%d\n", sink_stats.sunk);
+  statistics_counter_event (cfun, "Sunk statements", sink_stats.sunk);
   free_dominance_info (CDI_POST_DOMINATORS);
   remove_fake_exit_edges ();
   loop_optimizer_finalize ();
index fe3876ec3320f70016a4be0854d400377583f1fb..359702161c1759e9a14408b65d2be4d12ae3ae61 100644 (file)
@@ -1069,9 +1069,8 @@ thread_through_all_blocks (bool may_peel_loop_headers)
       retval |= thread_through_loop_header (loop, may_peel_loop_headers);
     }
 
-  if (dump_file && (dump_flags & TDF_STATS))
-    fprintf (dump_file, "\nJumps threaded: %lu\n",
-            thread_stats.num_threaded_edges);
+  statistics_counter_event (cfun, "Jumps threaded",
+                           thread_stats.num_threaded_edges);
 
   free_original_copy_tables ();
 
index 79a7461a1a9aee75d9deba700ab1ae5bf40c2ca1..d374a0640d2398a0db0ff2b72ebc8623a5a2f4a3 100644 (file)
@@ -2691,6 +2691,7 @@ vectorize_loops (void)
     }
   vect_loop_location = UNKNOWN_LOC;
 
+  statistics_counter_event (cfun, "Vectorized loops", num_vectorized_loops);
   if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)
       || (vect_print_dump_info (REPORT_VECTORIZED_LOOPS)
          && num_vectorized_loops > 0))
index 8636c5f4fa7b26de58803148fadc6625d2d4d409..15e7ee57dd69ac85dbb099bdefde4de45752a3b2 100644 (file)
@@ -4540,9 +4540,8 @@ process_assert_insertions (void)
   if (update_edges_p)
     bsi_commit_edge_inserts ();
 
-  if (dump_file && (dump_flags & TDF_STATS))
-    fprintf (dump_file, "\nNumber of ASSERT_EXPR expressions inserted: %d\n\n",
-            num_asserts);
+  statistics_counter_event (cfun, "Number of ASSERT_EXPR expressions inserted",
+                           num_asserts);
 }