From bd73623c908777daae42b70ee841e9c84fa7b9b4 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 8 Feb 2012 13:29:43 +0100 Subject: re PR rtl-optimization/52139 (ICE: in remove_insn, at emit-rtl.c:3960 with -O -fPIC -fno-tree-dominator-opts -fno-tree-fre) PR rtl-optimization/52139 * cfgrtl.c (cfg_layout_merge_blocks): If BB_END is a BARRIER after emit_insn_after_noloc, move BB_END to the last non-BARRIER insn before it. * gcc.dg/pr52139.c: New test. From-SVN: r184005 --- gcc/cfgrtl.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/cfgrtl.c') diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index bcc410a..8283da0 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -2871,6 +2871,11 @@ cfg_layout_merge_blocks (basic_block a, basic_block b) rtx first = BB_END (a), last; last = emit_insn_after_noloc (b->il.rtl->header, BB_END (a), a); + /* The above might add a BARRIER as BB_END, but as barriers + aren't valid parts of a bb, remove_insn doesn't update + BB_END if it is a barrier. So adjust BB_END here. */ + while (BB_END (a) != first && BARRIER_P (BB_END (a))) + BB_END (a) = PREV_INSN (BB_END (a)); delete_insn_chain (NEXT_INSN (first), last, false); b->il.rtl->header = NULL; } -- cgit v1.1