]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/117698 - SLP vectorization and alignment
authorRichard Biener <rguenther@suse.de>
Wed, 20 Nov 2024 12:32:48 +0000 (13:32 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 20 Nov 2024 17:38:14 +0000 (18:38 +0100)
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.

gcc/tree-vect-stmts.cc

index 5f7e1e622a86720d547e3879bf452127b0bc42f0..752ee457f6ddb9ab92ba35d6970e29dff80cf229 100644 (file)
@@ -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");