https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111917
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:bbd68241f7277850ba9f97c3d26c968f365f5479 commit r12-10015-gbbd68241f7277850ba9f97c3d26c968f365f5479 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)