https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108816
--- Comment #3 from CVS 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:63471c5008819bbf6ec32a6f4d8701fe57b96fa9 commit r13-6140-g63471c5008819bbf6ec32a6f4d8701fe57b96fa9 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.