https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106198
--- Comment #4 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:07dd0f7ba27d1fe9f0ce5b049ac5735dc5d361ad commit r13-1505-g07dd0f7ba27d1fe9f0ce5b049ac5735dc5d361ad Author: Richard Biener <rguent...@suse.de> Date: Tue Jul 5 14:14:49 2022 +0200 tree-optimization/106198 - CFG cleanup vs LC SSA This is another case like PR106182 where for the 2nd testcase in the bug there are no removed or discovered loops but still changing loop exits invalidates LC SSA and it is not enough to just scan for uses in the blocks that changed loop depth. One might argue that if we'd include former exit destinations we'd pick up the original LC SSA use but for virtuals on block merging we'd have propagated those out (while for regular uses we insert copies). CFG cleanup can also be entered with loops needing fixup so any heuristics based on loop structure are bound to fail. PR tree-optimization/106198 * tree-cfgcleanup.cc (repair_loop_structures): Always do a full LC SSA rewrite but only if any blocks changed loop depth. * gcc.dg/pr106198.c: New testcase.