]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Avoid vect_is_simple_use call from get_load_store_type
authorRichard Biener <rguenther@suse.de>
Thu, 10 Jul 2025 08:25:03 +0000 (10:25 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 10 Jul 2025 11:10:31 +0000 (13:10 +0200)
This isn't the required refactoring of vect_check_gather_scatter
but it avoids a now unnecessary call to vect_is_simple_use which
is problematic because it looks at STMT_VINFO_VECTYPE which we
want to get rid of.  SLP build already ensures vect_is_simple_use
on all lane defs, so all we need is to populate the offset_vectype
and offset_dt which is not always set by vect_check_gather_scatter.
That's both easy to get from the SLP child directly.

* tree-vect-stmts.cc (get_load_store_type): Do not use
vect_is_simple_use to fill gather/scatter offset operand
vectype and dt.

gcc/tree-vect-stmts.cc

index e5971e4a357b0a7a8b0c28757622b88f8993400b..4aa69da2218be2515c079b2453c7450cbfae1bcc 100644 (file)
@@ -2466,17 +2466,10 @@ get_load_store_type (vec_info  *vinfo, stmt_vec_info stmt_info,
                             vls_type == VLS_LOAD ? "gather" : "scatter");
          return false;
        }
-      else if (!vect_is_simple_use (gs_info->offset, vinfo,
-                                   &gs_info->offset_dt,
-                                   &gs_info->offset_vectype))
-       {
-         if (dump_enabled_p ())
-           dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-                            "%s index use not simple.\n",
-                            vls_type == VLS_LOAD ? "gather" : "scatter");
-         return false;
-       }
-      else if (gs_info->ifn == IFN_LAST && !gs_info->decl)
+      slp_tree offset_node = SLP_TREE_CHILDREN (slp_node)[0];
+      gs_info->offset_dt = SLP_TREE_DEF_TYPE (offset_node);
+      gs_info->offset_vectype = SLP_TREE_VECTYPE (offset_node);
+      if (gs_info->ifn == IFN_LAST && !gs_info->decl)
        {
          if (!TYPE_VECTOR_SUBPARTS (vectype).is_constant ()
              || !TYPE_VECTOR_SUBPARTS (gs_info->offset_vectype).is_constant ()