https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102827
--- Comment #4 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:d996799a507f9f4c379b55b004233be92fa63380 commit r12-4498-gd996799a507f9f4c379b55b004233be92fa63380 Author: Richard Biener <rguent...@suse.de> Date: Tue Oct 19 10:19:12 2021 +0200 tree-optimization/102827 - avoid stmts in preheader The PR shows that when carefully crafting the runtime alias condition in the vectorizer we might end up using defs from the loop preheader but will end up inserting the condition before the .LOOP_VECTORIZED call. So the following makes sure to insert invariants before that when we versioned the loop, preserving the invariant the vectorizer relies on. 2021-10-19 Richard Biener <rguent...@suse.de> PR tree-optimization/102827 * tree-if-conv.c (predicate_statements): Add pe parameter and use that edge to insert invariant stmts on. (combine_blocks): Pass through pe. (tree_if_conversion): Compute the edge to insert invariant stmts on and pass it along. * gcc.dg/pr102827.c: New testcase.