aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc/cfgcleanup.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc/cfgcleanup.c')
-rw-r--r--contrib/gcc/cfgcleanup.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/contrib/gcc/cfgcleanup.c b/contrib/gcc/cfgcleanup.c
index 008c8da9e577..df914ec0cf27 100644
--- a/contrib/gcc/cfgcleanup.c
+++ b/contrib/gcc/cfgcleanup.c
@@ -125,6 +125,8 @@ try_simplify_condjump (cbranch_block)
basic_block jump_block, jump_dest_block, cbranch_dest_block;
edge cbranch_jump_edge, cbranch_fallthru_edge;
rtx cbranch_insn;
+ rtx insn, next;
+ rtx end;
/* Verify that there are exactly two successors. */
if (!cbranch_block->succ
@@ -177,6 +179,26 @@ try_simplify_condjump (cbranch_block)
cbranch_fallthru_edge->flags &= ~EDGE_FALLTHRU;
update_br_prob_note (cbranch_block);
+ end = jump_block->end;
+ /* Deleting a block may produce unreachable code warning even when we are
+ not deleting anything live. Supress it by moving all the line number
+ notes out of the block. */
+ for (insn = jump_block->head; insn != NEXT_INSN (jump_block->end);
+ insn = next)
+ {
+ next = NEXT_INSN (insn);
+ if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
+ {
+ if (insn == jump_block->end)
+ {
+ jump_block->end = PREV_INSN (insn);
+ if (insn == end)
+ break;
+ }
+ reorder_insns_nobb (insn, insn, end);
+ end = insn;
+ }
+ }
/* Delete the block with the unconditional jump, and clean up the mess. */
flow_delete_block (jump_block);
tidy_fallthru_edge (cbranch_jump_edge, cbranch_block, cbranch_dest_block);