https://gcc.gnu.org/g:2383ed144b54be6bae5ba5aec8859c6c2e215daf

commit r15-5523-g2383ed144b54be6bae5ba5aec8859c6c2e215daf
Author: Richard Biener <rguent...@suse.de>
Date:   Wed Nov 20 13:32:48 2024 +0100

    tree-optimization/117698 - SLP vectorization and alignment
    
    When SLP vectorizing we fail to mark the general alignment check
    as irrelevant when using VMAT_STRIDED_SLP (the implementation checks
    for itself) and when VMAT_INVARIANT the override isn't effective.
    
    This results in extra FAILs on sparc which the following fixes.
    
            PR tree-optimization/117698
            * tree-vect-stmts.cc (get_group_load_store_type): Properly
            disregard alignment for VMAT_STRIDED_SLP and VMAT_INVARIANT.
            (vectorizable_load): Adjust guard for dumping whether we
            vectorize and unaligned access.
            (vectorizable_store): Likewise.

Diff:
---
 gcc/tree-vect-stmts.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 5f7e1e622a86..752ee457f6dd 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -2121,9 +2121,6 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info 
stmt_info,
            {
              gcc_assert (vls_type == VLS_LOAD);
              *memory_access_type = VMAT_INVARIANT;
-             /* Invariant accesses perform only component accesses, alignment
-                is irrelevant for them.  */
-             *alignment_support_scheme = dr_unaligned_supported;
            }
          /* Try using LOAD/STORE_LANES.  */
          else if (slp_node->ldst_lanes
@@ -2379,7 +2376,9 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info 
stmt_info,
     *memory_access_type = VMAT_GATHER_SCATTER;
 
   if (*memory_access_type == VMAT_GATHER_SCATTER
-      || *memory_access_type == VMAT_ELEMENTWISE)
+      || *memory_access_type == VMAT_ELEMENTWISE
+      || *memory_access_type == VMAT_STRIDED_SLP
+      || *memory_access_type == VMAT_INVARIANT)
     {
       *alignment_support_scheme = dr_unaligned_supported;
       *misalignment = DR_MISALIGNMENT_UNKNOWN;
@@ -8497,6 +8496,8 @@ vectorizable_store (vec_info *vinfo,
       if (dump_enabled_p ()
          && memory_access_type != VMAT_ELEMENTWISE
          && memory_access_type != VMAT_GATHER_SCATTER
+         && memory_access_type != VMAT_STRIDED_SLP
+         && memory_access_type != VMAT_INVARIANT
          && alignment_support_scheme != dr_aligned)
        dump_printf_loc (MSG_NOTE, vect_location,
                         "Vectorizing an unaligned access.\n");
@@ -10410,6 +10411,8 @@ vectorizable_load (vec_info *vinfo,
       if (dump_enabled_p ()
          && memory_access_type != VMAT_ELEMENTWISE
          && memory_access_type != VMAT_GATHER_SCATTER
+         && memory_access_type != VMAT_STRIDED_SLP
+         && memory_access_type != VMAT_INVARIANT
          && alignment_support_scheme != dr_aligned)
        dump_printf_loc (MSG_NOTE, vect_location,
                         "Vectorizing an unaligned access.\n");

Reply via email to