aboutsummaryrefslogtreecommitdiff
path: root/gcc/except.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-03-30 13:40:17 +0000
committerRichard Guenther <rguenther@suse.de>2012-03-30 13:40:17 +0000
commitdae99c26a7a407298a29e7aeddfe7189717f3309 (patch)
treee9003b61195eb2ee90f2007af7528d63e137c32f /gcc/except.c
parentad3636465b120dbddfae50c8a61f6f683ca36792 (diff)
2012-03-30 Richard Guenther <rguenther@suse.de>
PR middle-end/52772 * except.c (emit_to_new_bb_before): Move loop updating ... (dw2_build_landing_pads): ... here. Use a proper block for querying the loop father. * g++.dg/torture/pr52772.C: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@186011 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/except.c')
-rw-r--r--gcc/except.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/except.c b/gcc/except.c
index ddc865217bd..e3a9ef07422 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -918,12 +918,6 @@ emit_to_new_bb_before (rtx seq, rtx insn)
bb = create_basic_block (seq, last, prev_bb);
update_bb_for_insn (bb);
bb->flags |= BB_SUPERBLOCK;
- if (current_loops)
- {
- add_bb_to_loop (bb, prev_bb->loop_father);
- if (prev_bb->loop_father->header == prev_bb)
- prev_bb->loop_father->header = bb;
- }
return bb;
}
@@ -995,6 +989,16 @@ dw2_build_landing_pads (void)
e = make_edge (bb, bb->next_bb, e_flags);
e->count = bb->count;
e->probability = REG_BR_PROB_BASE;
+ if (current_loops)
+ {
+ struct loop *loop = bb->next_bb->loop_father;
+ /* If we created a pre-header block, add the new block to the
+ outer loop, otherwise to the loop itself. */
+ if (bb->next_bb == loop->header)
+ add_bb_to_loop (bb, loop_outer (loop));
+ else
+ add_bb_to_loop (bb, loop);
+ }
}
}