https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102659
--- Comment #5 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:3c0194d7ff21d61c02f3c6b111c83ef24a69e1f0 commit r12-4369-g3c0194d7ff21d61c02f3c6b111c83ef24a69e1f0 Author: Richard Biener <rguent...@suse.de> Date: Mon Oct 11 12:27:10 2021 +0200 tree-optimization/102659 - avoid undefined overflow after if-conversion The following makes sure to rewrite arithmetic with undefined behavior on overflow to a well-defined variant when moving them to be always executed as part of doing if-conversion for loop vectorization. 2021-10-11 Richard Biener <rguent...@suse.de> PR tree-optimization/102659 * tree-if-conv.c (need_to_rewrite_undefined): New flag. (if_convertible_gimple_assign_stmt_p): Mark the loop for rewrite when stmts with undefined behavior on integer overflow appear. (combine_blocks): Predicate also when we need to rewrite stmts. (predicate_statements): Rewrite affected stmts to something with well-defined behavior on overflow. (tree_if_conversion): Initialize need_to_rewrite_undefined. * gcc.dg/torture/pr69760.c: Adjust the testcase. * gcc.target/i386/avx2-vect-mask-store-move1.c: Expect to move the conversions to unsigned as well.