diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-03 11:38:04 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-03 11:38:04 +0000 |
commit | 35c67c833b78806f818339542f2db310b18349bd (patch) | |
tree | 89c43a99b22d5e7d34c2934ec55d1719cf2bab3a /gcc/tracer.c | |
parent | bc05341c10553db8c7abbe942dc5f6e683450a24 (diff) | |
download | gcc-35c67c833b78806f818339542f2db310b18349bd.tar.gz |
2012-04-03 Richard Guenther <rguenther@suse.de>
PR tree-optimization/52808
* tracer.c (tail_duplicate): Return whether we have duplicated
any block.
(tracer): If we have duplicated any block, cleanup the CFG.
* cfghooks.c (duplicate_block): If we duplicated a loop
header but not its loop, destroy the loop because it now has
multiple entries.
* tree-ssa-threadupdate.c (thread_through_loop_header): Tell
the cfg manipulation routines we are not creating a multiple
entry loop.
* gcc.dg/pr52808.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186104 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tracer.c')
-rw-r--r-- | gcc/tracer.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gcc/tracer.c b/gcc/tracer.c index 602e7580d99..8fb9817dbe9 100644 --- a/gcc/tracer.c +++ b/gcc/tracer.c @@ -59,7 +59,6 @@ static bool better_p (const_edge, const_edge); static edge find_best_successor (basic_block); static edge find_best_predecessor (basic_block); static int find_trace (basic_block, basic_block *); -static void tail_duplicate (void); /* Minimal outgoing edge probability considered for superblock formation. */ static int probability_cutoff; @@ -224,7 +223,7 @@ find_trace (basic_block bb, basic_block *trace) /* Look for basic blocks in frequency order, construct traces and tail duplicate if profitable. */ -static void +static bool tail_duplicate (void) { fibnode_t *blocks = XCNEWVEC (fibnode_t, last_basic_block); @@ -236,6 +235,7 @@ tail_duplicate (void) gcov_type cover_insns; int max_dup_insns; basic_block bb; + bool changed = false; /* Create an oversized sbitmap to reduce the chance that we need to resize it. */ @@ -332,6 +332,7 @@ tail_duplicate (void) bb2->index, copy->index, copy->frequency); bb2 = copy; + changed = true; } mark_bb_seen (bb2); bb = bb2; @@ -353,6 +354,8 @@ tail_duplicate (void) free (trace); free (counts); fibheap_delete (heap); + + return changed; } /* Main entry point to this file. */ @@ -360,6 +363,8 @@ tail_duplicate (void) static unsigned int tracer (void) { + bool changed; + gcc_assert (current_ir_type () == IR_GIMPLE); if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1) @@ -370,15 +375,14 @@ tracer (void) dump_flow_info (dump_file, dump_flags); /* Trace formation is done on the fly inside tail_duplicate */ - tail_duplicate (); + changed = tail_duplicate (); + if (changed) + free_dominance_info (CDI_DOMINATORS); - /* FIXME: We really only need to do this when we know tail duplication - has altered the CFG. */ - free_dominance_info (CDI_DOMINATORS); if (dump_file) dump_flow_info (dump_file, dump_flags); - return 0; + return changed ? TODO_cleanup_cfg : 0; } static bool |