https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118558
--- Comment #10 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:7fffff1deb47a70ff804f0b2cce7be7e5fe8ba13 commit r15-7149-g7fffff1deb47a70ff804f0b2cce7be7e5fe8ba13 Author: Richard Biener <rguent...@suse.de> Date: Tue Jan 21 14:58:43 2025 +0100 tree-optimization/118558 - fix alignment compute with VMAT_CONTIGUOUS_REVERSE There are calls to dr_misalignment left that do not correct for the offset (which is vector type dependent) when the stride is negative. Notably vect_known_alignment_in_bytes doesn't allow to pass through such offset which the following adds (computing the offset in vect_known_alignment_in_bytes would be possible as well, but the offset can be shared as seen). Eventually this function could go away. This leads to peeling for gaps not considerd, nor shortening of the access applied which is what fixes the testcase on x86_64. PR tree-optimization/118558 * tree-vectorizer.h (vect_known_alignment_in_bytes): Pass through offset to dr_misalignment. * tree-vect-stmts.cc (get_group_load_store_type): Compute offset applied for negative stride and use it when querying alignment of accesses. (vectorizable_load): Likewise. * gcc.dg/vect/pr118558.c: New testcase.