From: Jeff Law Date: Wed, 8 Jan 2014 05:56:31 +0000 (-0700) Subject: re PR middle-end/59285 (gcc.dg/builtin-unreachable-6.c:17:1: internal compiler error... X-Git-Tag: releases/gcc-4.9.0~1787 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=04af8ab664b576f02652dc0034393b3a563b28f7;p=thirdparty%2Fgcc.git re PR middle-end/59285 (gcc.dg/builtin-unreachable-6.c:17:1: internal compiler error: in rtl_verify_fallthru, at cfgrtl.c:2862) PR middle-end/59285 * ifcvt.c (merge_if_block): If we are merging a block with more than one successor with a block with no successors, remove any BARRIER after the second block. From-SVN: r206417 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 179ddd44eab5..0e828f3b42eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-01-07 Jeff Law + + PR middle-end/59285 + * ifcvt.c (merge_if_block): If we are merging a block with more than + one successor with a block with no successors, remove any BARRIER + after the second block. + 2014-01-07 Dan Xio Qiang * hw-doloop.c (reorg_loops): Release the bitmap obstack. diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index aaed2d07363e..0afcfc3762f5 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -3153,6 +3153,20 @@ merge_if_block (struct ce_if_block * ce_info) if (then_bb) { + /* If THEN_BB has no successors, then there's a BARRIER after it. + If COMBO_BB has more than one successor (THEN_BB), then that BARRIER + is no longer needed, and in fact it is incorrect to leave it in + the insn stream. */ + if (EDGE_COUNT (then_bb->succs) == 0 + && EDGE_COUNT (combo_bb->succs) > 1) + { + rtx end = NEXT_INSN (BB_END (then_bb)); + while (end && NOTE_P (end) && !NOTE_INSN_BASIC_BLOCK_P (end)) + end = NEXT_INSN (end); + + if (end && BARRIER_P (end)) + delete_insn (end); + } merge_blocks (combo_bb, then_bb); num_true_changes++; } @@ -3162,6 +3176,20 @@ merge_if_block (struct ce_if_block * ce_info) get their addresses taken. */ if (else_bb) { + /* If ELSE_BB has no successors, then there's a BARRIER after it. + If COMBO_BB has more than one successor (ELSE_BB), then that BARRIER + is no longer needed, and in fact it is incorrect to leave it in + the insn stream. */ + if (EDGE_COUNT (else_bb->succs) == 0 + && EDGE_COUNT (combo_bb->succs) > 1) + { + rtx end = NEXT_INSN (BB_END (else_bb)); + while (end && NOTE_P (end) && !NOTE_INSN_BASIC_BLOCK_P (end)) + end = NEXT_INSN (end); + + if (end && BARRIER_P (end)) + delete_insn (end); + } merge_blocks (combo_bb, else_bb); num_true_changes++; }