https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117510
--- Comment #2 from GCC 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:da64698159fe69b68f5264b54cebcb67c501b3cf commit r15-5082-gda64698159fe69b68f5264b54cebcb67c501b3cf Author: Richard Biener <rguent...@suse.de> Date: Mon Nov 11 09:40:20 2024 +0100 tree-optimization/117510 - fix guard hoisting validity check For the loop in the testcase we currently fail to hoist the guard check of the inner loop (m > 0) out of the outer loop because find_loop_guard checks all blocks of the outer loop for side-effects, including those that are skipped by the guard. This usually is harmless as the guard does not skip any blocks in the outer loop but in this case store-motion was applied to the inner loop and thus there's now a skipped store in the outer loop. The following properly skips blocks that are dominated by the entry to the skipped region. PR tree-optimization/117510 * tree-ssa-loop-unswitch.cc (find_loop_guard): Only check not skipped blocks for side-effects. * gcc.dg/vect/vect-outer-pr117510.c: New testcase.