https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106860
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:0386609923577e07354ee63754795b2f729e7e00 commit r13-2514-g0386609923577e07354ee63754795b2f729e7e00 Author: Richard Biener <rguent...@suse.de> Date: Wed Sep 7 10:44:33 2022 +0200 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.