basic_block src = e->src;
rtx insn = src->end;
+ if (e->flags & EDGE_COMPLEX)
+ return false;
+
if (try_redirect_by_replacing_jump (e, target))
return true;
/* Do this fast path late, as we want above code to simplify for cases
changed = 1;
b = c;
}
- /* The fallthru forwarder block can be deleted. */
- if (b->pred->pred_next == NULL
- && forwarder_block_p (b)
- && n_basic_blocks > 1
- && (b->pred->flags & EDGE_FALLTHRU)
- && (b->succ->flags & EDGE_FALLTHRU))
- {
- if (rtl_dump_file)
- fprintf (rtl_dump_file, "Deleting fallthru block %i.\n",
- b->index);
- c = BASIC_BLOCK (i ? i - 1 : i + 1);
- redirect_edge_succ (b->pred, b->succ->dest);
- flow_delete_block (b);
- changed = 1;
- b = c;
- }
-
/* Remove code labels no longer used.
Don't do the optimization before sibling calls are discovered,
as some branches may be hidden inside CALL_PLACEHOLDERs. */
- if (!(mode & CLEANUP_PRE_SIBCALL)
- && b->pred->pred_next == NULL
+ if (b->pred->pred_next == NULL
&& (b->pred->flags & EDGE_FALLTHRU)
+ && !(b->pred->flags & EDGE_COMPLEX)
&& GET_CODE (b->head) == CODE_LABEL
+ && (!(mode & CLEANUP_PRE_SIBCALL)
+ || !tail_recursion_label_p (b->head))
/* If previous block does end with condjump jumping to next BB,
we can't delete the label. */
&& (b->pred->src == ENTRY_BLOCK_PTR
fprintf (rtl_dump_file, "Deleted label in block %i.\n",
b->index);
}
+ /* The fallthru forwarder block can be deleted. */
+ if (b->pred->pred_next == NULL
+ && forwarder_block_p (b)
+ && n_basic_blocks > 1
+ && (b->pred->flags & EDGE_FALLTHRU)
+ && (b->succ->flags & EDGE_FALLTHRU)
+ && GET_CODE (b->head) != CODE_LABEL)
+ {
+ if (rtl_dump_file)
+ fprintf (rtl_dump_file, "Deleting fallthru block %i.\n",
+ b->index);
+ c = BASIC_BLOCK (i ? i - 1 : i + 1);
+ redirect_edge_succ (b->pred, b->succ->dest);
+ flow_delete_block (b);
+ changed = 1;
+ b = c;
+ }
+
/* A loop because chains of blocks might be combineable. */
while ((s = b->succ) != NULL
&& s->succ_next == NULL
&& (s->flags & EDGE_EH) == 0
&& (c = s->dest) != EXIT_BLOCK_PTR
+ && !(s->flags & EDGE_COMPLEX)
&& c->pred->pred_next == NULL
/* If the jump insn has side effects,
we can't kill the edge. */
case LABEL_REF:
{
rtx label = XEXP (x, 0);
- rtx olabel = label;
- rtx next;
/* Ignore remaining references to unreachable labels that
have been deleted. */
if (LABEL_REF_NONLOCAL_P (x))
break;
- /* If there are other labels following this one,
- replace it with the last of the consecutive labels. */
- for (next = NEXT_INSN (label); next; next = NEXT_INSN (next))
- {
- if (GET_CODE (next) == CODE_LABEL)
- label = next;
- else if (GET_CODE (next) != NOTE)
- break;
- else if ((NOTE_LINE_NUMBER (next) == NOTE_INSN_LOOP_BEG
- || NOTE_LINE_NUMBER (next) == NOTE_INSN_FUNCTION_END
- /* ??? Optional. Disables some optimizations, but
- makes gcov output more accurate with -O. */
- || (flag_test_coverage
- && NOTE_LINE_NUMBER (next) > 0)))
- break;
- }
-
XEXP (x, 0) = label;
if (! insn || ! INSN_DELETED_P (insn))
++LABEL_NUSES (label);
JUMP_LABEL (insn) = label;
else
{
- /* If we've changed the label, update notes accordingly. */
- if (label != olabel)
- {
- rtx note;
-
- /* We may have a REG_LABEL note to indicate that this
- instruction uses the label. */
- note = find_reg_note (insn, REG_LABEL, olabel);
- if (note)
- XEXP (note, 0) = label;
-
- /* We may also have a REG_EQUAL note to indicate that
- a register is being set to the address of the
- label. */
- note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
- if (note
- && GET_CODE (XEXP (note, 0)) == LABEL_REF
- && XEXP (XEXP (note, 0), 0) == olabel)
- XEXP (XEXP (note, 0), 0) = label;
- }
-
/* Add a REG_LABEL note for LABEL unless there already
is one. All uses of a label, except for labels
that are the targets of jumps, must have a