aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-split.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-loop-split.cc')
-rw-r--r--gcc/tree-ssa-loop-split.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/tree-ssa-loop-split.cc b/gcc/tree-ssa-loop-split.cc
index bccf621..fad4e83 100644
--- a/gcc/tree-ssa-loop-split.cc
+++ b/gcc/tree-ssa-loop-split.cc
@@ -531,16 +531,17 @@ split_loop (class loop *loop1)
tree guard_iv;
tree border = NULL_TREE;
affine_iv iv;
+ edge exit1;
- if (!single_exit (loop1)
+ if (!(exit1 = single_exit (loop1))
+ || EDGE_COUNT (exit1->src->succs) != 2
/* ??? We could handle non-empty latches when we split the latch edge
(not the exit edge), and put the new exit condition in the new block.
OTOH this executes some code unconditionally that might have been
skipped by the original exit before. */
|| !empty_block_p (loop1->latch)
|| !easy_exit_values (loop1)
- || !number_of_iterations_exit (loop1, single_exit (loop1), &niter,
- false, true)
+ || !number_of_iterations_exit (loop1, exit1, &niter, false, true)
|| niter.cmp == ERROR_MARK
/* We can't yet handle loops controlled by a != predicate. */
|| niter.cmp == NE_EXPR)
@@ -644,10 +645,13 @@ split_loop (class loop *loop1)
fix_loop_bb_probability (loop1, loop2, true_edge, false_edge);
/* Fix first loop's exit probability after scaling. */
- edge exit_to_latch1 = single_pred_edge (loop1->latch);
+ edge exit_to_latch1;
+ if (EDGE_SUCC (exit1->src, 0) == exit1)
+ exit_to_latch1 = EDGE_SUCC (exit1->src, 1);
+ else
+ exit_to_latch1 = EDGE_SUCC (exit1->src, 0);
exit_to_latch1->probability *= true_edge->probability;
- single_exit (loop1)->probability
- = exit_to_latch1->probability.invert ();
+ exit1->probability = exit_to_latch1->probability.invert ();
/* Finally patch out the two copies of the condition to be always
true/false (or opposite). */