Commit 01902653 by Richard Guenther Committed by Richard Biener

tree-ssa-reassoc.c (fini_reassoc): Use the statistics infrastructure.

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
parent e13a4010
2008-05-20 Richard Guenther <rguenther@suse.de> 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. * tree-vn.c (vn_lookup_with_vuses): Do not use the alias oracle.
2008-05-20 Kai Tietz <kai.tietz@onevision.com> 2008-05-20 Kai Tietz <kai.tietz@onevision.com>
......
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> 2008-05-20 Sandra Loosemore <sandra@codesourcery.com>
* gcc.c-torture/compile/20061214-1.c: New test. * gcc.c-torture/compile/20061214-1.c: New test.
......
...@@ -7,5 +7,5 @@ foo (int a, int b, int c) ...@@ -7,5 +7,5 @@ foo (int a, int b, int c)
return c ? x : a; return c ? x : a;
} }
/* We should sink the x = a * b calculation into the branch that returns x. */ /* 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" } } */ /* { dg-final { cleanup-tree-dump "sink" } } */
...@@ -9,5 +9,5 @@ bar (int a, int b, int c) ...@@ -9,5 +9,5 @@ bar (int a, int b, int c)
return y; return y;
} }
/* We should sink the x = a * b calculation into the else branch */ /* 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" } } */ /* { dg-final { cleanup-tree-dump "sink" } } */
...@@ -12,5 +12,5 @@ main (int argc) ...@@ -12,5 +12,5 @@ main (int argc)
} }
} }
/* We should sink the a = argc + 1 calculation into the if branch */ /* 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" } } */ /* { dg-final { cleanup-tree-dump "sink" } } */
...@@ -17,5 +17,5 @@ main (int argc) ...@@ -17,5 +17,5 @@ main (int argc)
foo2 (a); foo2 (a);
} }
/* We should sink the first a = b + c calculation into the else branch */ /* 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" } } */ /* { dg-final { cleanup-tree-dump "sink" } } */
...@@ -735,22 +735,19 @@ eliminate_unnecessary_stmts (void) ...@@ -735,22 +735,19 @@ eliminate_unnecessary_stmts (void)
static void static void
print_stats (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; percg = ((float) stats.removed / (float) stats.total) * 100;
fprintf (dump_file, "Removed %d of %d statements (%d%%)\n", fprintf (dump_file, "Removed %d of %d statements (%d%%)\n",
stats.removed, stats.total, (int) percg); stats.removed, stats.total, (int) percg);
if (stats.total_phis == 0) if (stats.total_phis == 0)
percg = 0; percg = 0;
else else
percg = ((float) stats.removed_phis / (float) stats.total_phis) * 100; percg = ((float) stats.removed_phis / (float) stats.total_phis) * 100;
fprintf (dump_file, "Removed %d of %d PHI nodes (%d%%)\n", fprintf (dump_file, "Removed %d of %d PHI nodes (%d%%)\n",
stats.removed_phis, stats.total_phis, (int) percg); stats.removed_phis, stats.total_phis, (int) percg);
}
} }
/* Initialization for this pass. Set up the used data structures. */ /* Initialization for this pass. Set up the used data structures. */
...@@ -854,8 +851,11 @@ perform_tree_ssa_dce (bool aggressive) ...@@ -854,8 +851,11 @@ perform_tree_ssa_dce (bool aggressive)
if (cfg_altered) if (cfg_altered)
free_dominance_info (CDI_DOMINATORS); 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. */ /* Debugging dumps. */
if (dump_file) if (dump_file && (dump_flags & (TDF_STATS|TDF_DETAILS)))
print_stats (); print_stats ();
tree_dce_done (aggressive); tree_dce_done (aggressive);
......
...@@ -357,6 +357,13 @@ tree_ssa_dominator_optimize (void) ...@@ -357,6 +357,13 @@ tree_ssa_dominator_optimize (void)
SSA_NAME_VALUE (name) = NULL; 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. */ /* Debugging dumps. */
if (dump_file && (dump_flags & TDF_STATS)) if (dump_file && (dump_flags & TDF_STATS))
dump_dominator_optimization_stats (dump_file); dump_dominator_optimization_stats (dump_file);
...@@ -868,25 +875,11 @@ record_equivalences_from_incoming_edge (basic_block bb) ...@@ -868,25 +875,11 @@ record_equivalences_from_incoming_edge (basic_block bb)
void void
dump_dominator_optimization_stats (FILE *file) dump_dominator_optimization_stats (FILE *file)
{ {
long n_exprs;
fprintf (file, "Total number of statements: %6ld\n\n", fprintf (file, "Total number of statements: %6ld\n\n",
opt_stats.num_stmts); opt_stats.num_stmts);
fprintf (file, "Exprs considered for dominator optimizations: %6ld\n", fprintf (file, "Exprs considered for dominator optimizations: %6ld\n",
opt_stats.num_exprs_considered); 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, "\nHash table statistics:\n");
fprintf (file, " avail_exprs: "); fprintf (file, " avail_exprs: ");
......
...@@ -1487,18 +1487,14 @@ init_reassoc (void) ...@@ -1487,18 +1487,14 @@ init_reassoc (void)
static void static void
fini_reassoc (void) fini_reassoc (void)
{ {
if (dump_file && (dump_flags & TDF_STATS)) statistics_counter_event (cfun, "Linearized",
{ reassociate_stats.linearized);
fprintf (dump_file, "Reassociation stats:\n"); statistics_counter_event (cfun, "Constants eliminated",
fprintf (dump_file, "Linearized: %d\n", reassociate_stats.constants_eliminated);
reassociate_stats.linearized); statistics_counter_event (cfun, "Ops eliminated",
fprintf (dump_file, "Constants eliminated: %d\n", reassociate_stats.ops_eliminated);
reassociate_stats.constants_eliminated); statistics_counter_event (cfun, "Statements rewritten",
fprintf (dump_file, "Ops eliminated: %d\n", reassociate_stats.rewritten);
reassociate_stats.ops_eliminated);
fprintf (dump_file, "Statements rewritten: %d\n",
reassociate_stats.rewritten);
}
pointer_map_destroy (operand_rank); pointer_map_destroy (operand_rank);
free_alloc_pool (operand_entry_pool); free_alloc_pool (operand_entry_pool);
......
...@@ -1947,9 +1947,7 @@ process_scc (VEC (tree, heap) *scc) ...@@ -1947,9 +1947,7 @@ process_scc (VEC (tree, heap) *scc)
changed |= visit_use (var); changed |= visit_use (var);
} }
if (dump_file && (dump_flags & TDF_STATS)) statistics_histogram_event (cfun, "SCC iterations", iterations);
fprintf (dump_file, "Processing SCC required %d iterations\n",
iterations);
/* Finally, visit the SCC once using the valid table. */ /* Finally, visit the SCC once using the valid table. */
current_info = valid_info; current_info = valid_info;
......
...@@ -546,8 +546,7 @@ execute_sink_code (void) ...@@ -546,8 +546,7 @@ execute_sink_code (void)
calculate_dominance_info (CDI_DOMINATORS); calculate_dominance_info (CDI_DOMINATORS);
calculate_dominance_info (CDI_POST_DOMINATORS); calculate_dominance_info (CDI_POST_DOMINATORS);
sink_code_in_bb (EXIT_BLOCK_PTR); sink_code_in_bb (EXIT_BLOCK_PTR);
if (dump_file && (dump_flags & TDF_STATS)) statistics_counter_event (cfun, "Sunk statements", sink_stats.sunk);
fprintf (dump_file, "Sunk statements:%d\n", sink_stats.sunk);
free_dominance_info (CDI_POST_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS);
remove_fake_exit_edges (); remove_fake_exit_edges ();
loop_optimizer_finalize (); loop_optimizer_finalize ();
......
...@@ -1069,9 +1069,8 @@ thread_through_all_blocks (bool may_peel_loop_headers) ...@@ -1069,9 +1069,8 @@ thread_through_all_blocks (bool may_peel_loop_headers)
retval |= thread_through_loop_header (loop, may_peel_loop_headers); retval |= thread_through_loop_header (loop, may_peel_loop_headers);
} }
if (dump_file && (dump_flags & TDF_STATS)) statistics_counter_event (cfun, "Jumps threaded",
fprintf (dump_file, "\nJumps threaded: %lu\n", thread_stats.num_threaded_edges);
thread_stats.num_threaded_edges);
free_original_copy_tables (); free_original_copy_tables ();
......
...@@ -2691,6 +2691,7 @@ vectorize_loops (void) ...@@ -2691,6 +2691,7 @@ vectorize_loops (void)
} }
vect_loop_location = UNKNOWN_LOC; vect_loop_location = UNKNOWN_LOC;
statistics_counter_event (cfun, "Vectorized loops", num_vectorized_loops);
if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS) if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)
|| (vect_print_dump_info (REPORT_VECTORIZED_LOOPS) || (vect_print_dump_info (REPORT_VECTORIZED_LOOPS)
&& num_vectorized_loops > 0)) && num_vectorized_loops > 0))
......
...@@ -4540,9 +4540,8 @@ process_assert_insertions (void) ...@@ -4540,9 +4540,8 @@ process_assert_insertions (void)
if (update_edges_p) if (update_edges_p)
bsi_commit_edge_inserts (); bsi_commit_edge_inserts ();
if (dump_file && (dump_flags & TDF_STATS)) statistics_counter_event (cfun, "Number of ASSERT_EXPR expressions inserted",
fprintf (dump_file, "\nNumber of ASSERT_EXPR expressions inserted: %d\n\n", num_asserts);
num_asserts);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment