https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111917
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:ec8d0c33211c5e92c220483d6fe9f0a2391d2d6d commit r11-11145-gec8d0c33211c5e92c220483d6fe9f0a2391d2d6d 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.c (hoist_guard): Always insert new conditional after last stmt. * gcc.dg/torture/pr111917.c: New testcase. (cherry picked from commit d96bd4aade170fcd86f5f09b68b770dde798e631)