tree-optimization/106860 - fix profile scaling in split_loop
authorRichard Biener <rguenther@suse.de>
Wed, 7 Sep 2022 08:44:33 +0000 (10:44 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 7 Sep 2022 10:08:59 +0000 (12:08 +0200)
commit0386609923577e07354ee63754795b2f729e7e00
tree93223fdd5fdda888c75e21b0fe9ec617a4be13a7
parentd14514641d7d2052bc2bf1f09018e1f18f19850a
tree-optimization/106860 - fix profile scaling in split_loop

The following fixes a mistake in loop splitting which assumes loop
latches have a single predecessor and that edge is from the exit
test.  Instead work from the single exit edge we have to find the
edge towards the latch.

PR tree-optimization/106860
* tree-ssa-loop-split.cc (split_loop): Find the exit to
latch edge from the loop exit edge instead of from the
latch.  Verify we're going to find it.

* g++.dg/opt/pr106860.C: New testcase.
gcc/testsuite/g++.dg/opt/pr106860.C [new file with mode: 0644]
gcc/tree-ssa-loop-split.cc