summaryrefslogtreecommitdiff
path: root/gcc/tree-eh.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-17 13:42:48 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-17 13:42:48 +0000
commit3a37f7bd8a3a8f836d884dddc2b8ac62ff794524 (patch)
treea481bf2c7620ac00b781d4d362582751514e3c3f /gcc/tree-eh.c
parent2bc1ac5ae62fa3adf98e8d8578da9cfd725f4694 (diff)
downloadgcc-3a37f7bd8a3a8f836d884dddc2b8ac62ff794524.tar.gz
2012-04-17 Richard Guenther <rguenther@suse.de>
PR middle-end/53011 * tree-eh.c (cleanup_empty_eh_merge_phis): Properly discard loops when redirecting an entry or latch edge. * g++.dg/torture/pr53011.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186529 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-eh.c')
-rw-r--r--gcc/tree-eh.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index ba188d85a77..0241a5f1bc4 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -3916,6 +3916,21 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb,
for (ei = ei_start (old_bb->preds); (e = ei_safe_edge (ei)); )
if (e->flags & EDGE_EH)
{
+ /* ??? CFG manipluation routines do not try to update loop
+ form on edge redirection. Do so manually here for now. */
+ /* If we redirect a loop entry or latch edge that will either create
+ a multiple entry loop or rotate the loop. If the loops merge
+ we may have created a loop with multiple latches.
+ All of this isn't easily fixed thus cancel the affected loop
+ and mark the other loop as possibly having multiple latches. */
+ if (current_loops
+ && e->dest == e->dest->loop_father->header)
+ {
+ e->dest->loop_father->header = NULL;
+ e->dest->loop_father->latch = NULL;
+ new_bb->loop_father->latch = NULL;
+ loops_state_set (LOOPS_NEED_FIXUP|LOOPS_MAY_HAVE_MULTIPLE_LATCHES);
+ }
redirect_eh_edge_1 (e, new_bb, change_region);
redirect_edge_succ (e, new_bb);
flush_pending_stmts (e);