aboutsummaryrefslogtreecommitdiff
path: root/gcc/ifcvt.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2014-01-07 22:56:31 -0700
committerJeff Law <law@gcc.gnu.org>2014-01-07 22:56:31 -0700
commit04af8ab664b576f02652dc0034393b3a563b28f7 (patch)
tree138fe20de88dfa01a05ad289aae6f69169c43023 /gcc/ifcvt.c
parent955b33ed1d2187b8d8fc251e379ddedfe2231f77 (diff)
downloadgcc-04af8ab664b576f02652dc0034393b3a563b28f7.zip
gcc-04af8ab664b576f02652dc0034393b3a563b28f7.tar.gz
gcc-04af8ab664b576f02652dc0034393b3a563b28f7.tar.bz2
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
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r--gcc/ifcvt.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index aaed2d0..0afcfc3 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++;
}