aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-split.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-09-22 06:29:20 -0700
committerIan Lance Taylor <iant@golang.org>2022-09-22 06:29:20 -0700
commit795cffe109e28b248a54b8ee583cbae48368c2a7 (patch)
tree0c12b075c51c0d5097f26953835ae540d9f2f501 /gcc/tree-ssa-loop-split.cc
parent9f62ed218fa656607740b386c0caa03e65dcd283 (diff)
parentf35be1268c996d993ab0b4ff329734d467474445 (diff)
downloadgcc-795cffe109e28b248a54b8ee583cbae48368c2a7.zip
gcc-795cffe109e28b248a54b8ee583cbae48368c2a7.tar.gz
gcc-795cffe109e28b248a54b8ee583cbae48368c2a7.tar.bz2
Merge from trunk revision f35be1268c996d993ab0b4ff329734d467474445.
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). */