summaryrefslogtreecommitdiff
path: root/gcc/cfghooks.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-04-03 11:38:04 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-04-03 11:38:04 +0000
commit07b1bf209c2fa991491ea9317d8afe225dd44f97 (patch)
tree89c43a99b22d5e7d34c2934ec55d1719cf2bab3a /gcc/cfghooks.c
parent90b2952fa43b86c74d7ad99893f757abf30788f5 (diff)
downloadgcc-07b1bf209c2fa991491ea9317d8afe225dd44f97.tar.gz
re PR bootstrap/52808 (LTO bootstrap failed with bootstrap-profiled)
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. From-SVN: r186104
Diffstat (limited to 'gcc/cfghooks.c')
-rw-r--r--gcc/cfghooks.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 1dca79a70cf..bc1b7a2f582 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -1009,18 +1009,28 @@ duplicate_block (basic_block bb, edge e, basic_block after)
{
struct loop *cloop = bb->loop_father;
struct loop *copy = get_loop_copy (cloop);
- add_bb_to_loop (new_bb, copy ? copy : cloop);
- /* If we copied the loop latch block but not the loop, adjust
- loop state.
- ??? If we copied the loop header block but not the loop
- we might either have created a loop copy or a loop with
- multiple entries. In both cases we probably have to
- ditch the loops and arrange for a fixup. */
+ /* If we copied the loop header block but not the loop
+ we have created a loop with multiple entries. Ditch the loop,
+ add the new block to the outer loop and arrange for a fixup. */
if (!copy
- && cloop->latch == bb)
+ && cloop->header == bb)
{
+ add_bb_to_loop (new_bb, loop_outer (cloop));
+ cloop->header = NULL;
cloop->latch = NULL;
- loops_state_set (LOOPS_MAY_HAVE_MULTIPLE_LATCHES);
+ loops_state_set (LOOPS_NEED_FIXUP);
+ }
+ else
+ {
+ add_bb_to_loop (new_bb, copy ? copy : cloop);
+ /* If we copied the loop latch block but not the loop, adjust
+ loop state. */
+ if (!copy
+ && cloop->latch == bb)
+ {
+ cloop->latch = NULL;
+ loops_state_set (LOOPS_MAY_HAVE_MULTIPLE_LATCHES);
+ }
}
}