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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
So sth along the PR108979 patch doesn't help:

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 61e508fcb6c..be963aea16f 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -3365,6 +3365,7 @@ vectorizable_call (vec_info *vinfo,
   if (internal_fn_p (cfn))
     mask_opno = internal_fn_mask_index (as_internal_fn (cfn));

+  bool is_invariant = true;
   for (i = 0; i < nargs; i++)
     {
       if ((int) i == mask_opno)
@@ -3383,6 +3384,8 @@ vectorizable_call (vec_info *vinfo,
                             "use not simple.\n");
          return false;
        }
+      if (dt[i] != vect_external_def && dt[i] != vect_constant_def)
+       is_invariant = false;

       /* We can only handle calls with arguments of the same type.  */
       if (rhs_type
@@ -3607,7 +3610,8 @@ vectorizable_call (vec_info *vinfo,
   scalar_dest = gimple_call_lhs (stmt);
   vec_dest = vect_create_destination_var (scalar_dest, vectype_out);

-  bool masked_loop_p = loop_vinfo && LOOP_VINFO_FULLY_MASKED_P (loop_vinfo);
+  bool masked_loop_p
+    = !is_invariant && loop_vinfo && LOOP_VINFO_FULLY_MASKED_P (loop_vinfo);
   unsigned int vect_nargs = nargs;
   if (masked_loop_p && reduc_idx >= 0)
     {

Reply via email to