https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108816
--- Comment #5 from CVS 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:02ff8c8ebcb7f9b0885946d17ff12523e7522b71 commit r12-9260-g02ff8c8ebcb7f9b0885946d17ff12523e7522b71 Author: Richard Biener <rguent...@suse.de> Date: Mon Feb 20 10:59:15 2023 +0100 tree-optimization/108816 - vect versioning check split confusion The split of the versioning condition assumes the definition is in the condition block which is ensured by the versioning code. But that only works when we actually have to insert any statements for the versioning condition. The following adjusts the guard accordingly and asserts this condition. PR tree-optimization/108816 * tree-vect-loop-manip.cc (vect_loop_versioning): Adjust versioning condition split prerequesite, assert required invariant. * gcc.dg/torture/pr108816.c: New testcase. (cherry picked from commit 63471c5008819bbf6ec32a6f4d8701fe57b96fa9)