https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118669

Richard Sandiford <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|wrong-code                  |internal-improvement
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot 
gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #7 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index c0550acf6b2..06cd6e42355 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -9908,7 +9908,8 @@ vectorizable_store (vec_info *vinfo,
                = fold_build2 (MEM_REF, vectype, dataref_ptr,
                               dataref_offset ? dataref_offset
                                              : build_int_cst (ref_type, 0));
-             if (alignment_support_scheme == dr_aligned)
+             if (alignment_support_scheme == dr_aligned
+                 && align >= TYPE_ALIGN_UNIT (vectype))
                ;
              else
                TREE_TYPE (data_ref)

seems to fix it.  (Loads will need similar treatment.)

The justification is that preferred_vector_alignment requests element alignment
for SVE, even though the vector mode itself has 128-bit alignment.  In that
context, dr_aligned means that element alignment has been reached.

It looks like a long-standing issue, so I suppose it should wait for GCC 16.

Reply via email to