if (!can_fallthru (jump_block, cbranch_dest_block))
return false;
- /* Invert the conditional branch. Prevent jump.c from deleting
- "unreachable" instructions. */
- LABEL_NUSES (JUMP_LABEL (cbranch_insn))++;
- if (!invert_jump (cbranch_insn, block_label (jump_dest_block), 1))
- {
- LABEL_NUSES (JUMP_LABEL (cbranch_insn))--;
- return false;
- }
+ /* Invert the conditional branch. */
+ if (!invert_jump (cbranch_insn, block_label (jump_dest_block), 0))
+ return false;
if (rtl_dump_file)
fprintf (rtl_dump_file, "Simplifying condjump %i around jump %i\n",
merge_blocks_move_successor_nojumps (a, b)
basic_block a, b;
{
- rtx barrier;
+ rtx barrier, real_b_end;
+ real_b_end = b->end;
barrier = NEXT_INSN (b->end);
/* Recognize a jump table following block B. */
&& (GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_VEC
|| GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_DIFF_VEC))
{
+ /* Temporarily add the table jump insn to b, so that it will also
+ be moved to the correct location. */
b->end = NEXT_INSN (barrier);
barrier = NEXT_INSN (b->end);
}
/* Scramble the insn chain. */
reorder_insns_nobb (b->head, b->end, a->end);
+ /* Restore the real end of b. */
+ b->end = real_b_end;
+
/* Now blocks A and B are contiguous. Merge them. */
merge_blocks_nomove (a, b);
newpos1 = NEXT_INSN (newpos1);
last = src1->end;
- /* Emit the jump insn. */
+ /* Emit the jump insn. */
label = block_label (redirect_to);
emit_jump_insn_after (gen_jump (label), src1->end);
JUMP_LABEL (src1->end) = label;
bool changed;
int iterations = 0;
+ if (mode & CLEANUP_CROSSJUMP)
+ add_noreturn_fake_exit_edges ();
+
/* Attempt to merge blocks as made possible by edge removal. If a block
has only one successor, and the successor has only one predecessor,
they may be combined. */
changed_overall |= changed;
}
while (changed);
+
+ if (mode & CLEANUP_CROSSJUMP)
+ remove_fake_edges ();
+
return changed_overall;
}
\f
-/* Delete all unreachable basic blocks. */
+/* Delete all unreachable basic blocks. */
static bool
delete_unreachable_blocks ()