https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111917
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:28d9e033a8e95c024e27cb495db610aac37a0f88 commit r13-8045-g28d9e033a8e95c024e27cb495db610aac37a0f88 Author: Richard Biener <rguent...@suse.de> Date: Mon Oct 23 11:25:17 2023 +0200 tree-optimization/111917 - bougs IL after guard hoisting The unswitching code to hoist guards inserts conditions in wrong places. The following fixes this, simplifying code. PR tree-optimization/111917 * tree-ssa-loop-unswitch.cc (hoist_guard): Always insert new conditional after last stmt. * gcc.dg/torture/pr111917.c: New testcase. (cherry picked from commit d96bd4aade170fcd86f5f09b68b770dde798e631)