summaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 1f934cb7ec5..b59c8f7ccbb 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4247,17 +4247,15 @@ static edge
tree_try_redirect_by_replacing_jump (edge e, basic_block target)
{
basic_block src = e->src;
- edge tmp;
block_stmt_iterator b;
tree stmt;
- edge_iterator ei;
-
- /* Verify that all targets will be TARGET. */
- FOR_EACH_EDGE (tmp, ei, src->succs)
- if (tmp->dest != target && tmp != e)
- break;
- if (tmp)
+ /* We can replace or remove a complex jump only when we have exactly
+ two edges. */
+ if (EDGE_COUNT (src->succs) != 2
+ /* Verify that all targets will be TARGET. Specifically, the
+ edge that is not E must also go to TARGET. */
+ || EDGE_SUCC (src, EDGE_SUCC (src, 0) == e)->dest != target)
return NULL;
b = bsi_last (src);