]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Avoid incomplete SLP handling for OMP SIMD calls with linear/invariant clause
authorRichard Biener <rguenther@suse.de>
Mon, 24 Nov 2025 14:10:22 +0000 (15:10 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 24 Nov 2025 18:18:55 +0000 (19:18 +0100)
The following restricts these cases to single-lange SLP as they look
at only the representative scalar argument.

PR tree-optimization/122826
* tree-vect-stmts.cc (vectorizable_simd_clone_call): Only
use single-lane SLP for SIMD_CLONE_ARG_TYPE_UNIFORM
and SIMD_CLONE_ARG_TYPE_LINEAR_[REF_]CONSTANT_STEP.

gcc/tree-vect-stmts.cc

index a18772f5928e59b800a1d6efe4392eb578aac44f..ce68c8770a9812b84d2b66e45a8b8cfa4344c81e 100644 (file)
@@ -4159,7 +4159,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
        gcc_assert (thisarginfo.vectype != NULL_TREE);
 
       /* For linear arguments, the analyze phase should have saved
-        the base and step in {STMT_VINFO,SLP_TREE}_SIMD_CLONE_INFO.  */
+        the base and step.  */
       if (!cost_vec
          && i * 3 + 4 <= simd_clone_info.length ()
          && simd_clone_info[i * 3 + 2])
@@ -4188,6 +4188,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
               && thisarginfo.dt != vect_constant_def
               && thisarginfo.dt != vect_external_def
               && loop_vinfo
+              && SLP_TREE_LANES (slp_node) == 1
               && TREE_CODE (op) == SSA_NAME
               && simple_iv (loop, loop_containing_stmt (stmt), op,
                             &iv, false)
@@ -4198,11 +4199,13 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
        }
       else if ((thisarginfo.dt == vect_constant_def
                || thisarginfo.dt == vect_external_def)
+              && SLP_TREE_LANES (slp_node) == 1
               && POINTER_TYPE_P (TREE_TYPE (op)))
        thisarginfo.align = get_pointer_alignment (op) / BITS_PER_UNIT;
       /* Addresses of array elements indexed by GOMP_SIMD_LANE are
         linear too.  */
-      if (POINTER_TYPE_P (TREE_TYPE (op))
+      if (SLP_TREE_LANES (slp_node) == 1
+         && POINTER_TYPE_P (TREE_TYPE (op))
          && !thisarginfo.linear_step
          && cost_vec
          && thisarginfo.dt != vect_constant_def
@@ -4276,8 +4279,9 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
                  this_badness += 64;
                break;
              case SIMD_CLONE_ARG_TYPE_UNIFORM:
-               if (arginfo[i].dt != vect_constant_def
-                   && arginfo[i].dt != vect_external_def)
+               if ((arginfo[i].dt != vect_constant_def
+                    && arginfo[i].dt != vect_external_def)
+                   || SLP_TREE_LANES (slp_node) != 1)
                  i = -1;
                break;
              case SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP: