]> git.ipfire.org Git - thirdparty/gcc.git/commit
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>
Fri, 9 Sep 2022 09:49:40 +0000 (11:49 +0200)
commit4ce316ca54c863cf0fd4257ba0ab768ab83c62e5
tree670242494967c8fcd7cb65b0e84aab84eca67d60
parent41b4faa130a32b37debb1f92e3fa93b2fe8571fc
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.

(cherry picked from commit 0386609923577e07354ee63754795b2f729e7e00)
gcc/testsuite/g++.dg/opt/pr106860.C [new file with mode: 0644]
gcc/tree-ssa-loop-split.cc