https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116902
--- Comment #4 from GCC 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:27ddda8b4cb51739e841053c29d9b5f503467e99 commit r15-3988-g27ddda8b4cb51739e841053c29d9b5f503467e99 Author: Richard Biener <rguent...@suse.de> Date: Tue Oct 1 13:35:58 2024 +0200 tree-optimization/116902 - vectorizer load hosting breaks UID order #2 This is another case of load hoisting breaking UID order in the preheader, this time between two hoistings. The easiest way out is to do what we do for the main stmt - copy instead of move. PR tree-optimization/116902 PR tree-optimization/116842 * tree-vect-stmts.cc (sort_after_uid): Remove again. (hoist_defs_of_uses): Copy defs instead of hoisting them so we can zero their UID. (vectorizable_load): Separate analysis and transform call, do transform on the stmt copy. * g++.dg/torture/pr116902.C: New testcase.