aboutsummaryrefslogtreecommitdiff
path: root/gcc/flow.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>2001-07-18 10:11:11 -0700
committerJan Hubicka <hubicka@gcc.gnu.org>2001-07-18 17:11:11 +0000
commit0728902f90acc1f79eecea7b6715bc1022c7f7c8 (patch)
treedc545ee97f3d0bb608afc67d322814c81f69c353 /gcc/flow.c
parent02d92e3b707a5433814ca22aab53da2d229dc3e1 (diff)
downloadgcc-0728902f90acc1f79eecea7b6715bc1022c7f7c8.zip
gcc-0728902f90acc1f79eecea7b6715bc1022c7f7c8.tar.gz
gcc-0728902f90acc1f79eecea7b6715bc1022c7f7c8.tar.bz2
flow.c (redirect_edge_and_branch): Bail out on complex edges.
* flow.c (redirect_edge_and_branch): Bail out on complex edges. (try_optimize_cfg): Do not remove tail recursive labels before sibcall. * jump.c (mark_jump_label): Do not forward branches. Co-Authored-By: Jan Hubicka <jh@suse.cz> From-SVN: r44118
Diffstat (limited to 'gcc/flow.c')
-rw-r--r--gcc/flow.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/gcc/flow.c b/gcc/flow.c
index 6e6c2b6..06a1040 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -1777,6 +1777,9 @@ redirect_edge_and_branch (e, target)
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
@@ -3683,30 +3686,15 @@ try_optimize_cfg (mode)
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
@@ -3719,12 +3707,31 @@ try_optimize_cfg (mode)
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. */