]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Eliminate gather-scatter-info offset_dt member
authorRichard Biener <rguenther@suse.de>
Mon, 28 Jul 2025 12:22:44 +0000 (14:22 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 29 Jul 2025 06:38:14 +0000 (08:38 +0200)
The following removes this only set member.  Sligthly complicated
by the hoops get_group_load_store_type jumps through.  I've simplified
that, noting the offset vector type that's relevant is that of the
actual offset SLP node, not of what vect_check_gather_scatter (re-)computes.

* tree-vectorizer.h (gather_scatter_info::offset_dt): Remove.
* tree-vect-data-refs.cc (vect_describe_gather_scatter_call):
Do not set it.
(vect_check_gather_scatter): Likewise.
* tree-vect-stmts.cc (vect_truncate_gather_scatter_offset):
Likewise.
(get_group_load_store_type): Use the vector type of the offset
SLP child.  Do not re-check vect_is_simple_use validated by
SLP build.

gcc/tree-vect-data-refs.cc
gcc/tree-vect-stmts.cc
gcc/tree-vectorizer.h

index 3bf285261c6aac80858dc679a406f950ccc04840..e7919b73c2584cea7cefcada612c1dbbf12c001f 100644 (file)
@@ -4542,7 +4542,6 @@ vect_describe_gather_scatter_call (stmt_vec_info stmt_info,
                     (call, internal_fn_alias_ptr_index (info->ifn));
   info->offset = gimple_call_arg
                  (call, internal_fn_offset_index (info->ifn));
-  info->offset_dt = vect_unknown_def_type;
   info->offset_vectype = NULL_TREE;
   info->scale = TREE_INT_CST_LOW (gimple_call_arg
                                  (call, internal_fn_scale_index (info->ifn)));
@@ -4872,7 +4871,6 @@ vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo,
      get_object_alignment (DR_REF (dr)));
 
   info->offset = off;
-  info->offset_dt = vect_unknown_def_type;
   info->offset_vectype = offset_vectype;
   info->scale = scale;
   info->element_type = TREE_TYPE (vectype);
index 9edc4a8990cb8c6795d8eab945f9b198687e17fc..155330f22434bb166d6ffb7937d4527376957053 100644 (file)
@@ -1676,7 +1676,6 @@ vect_truncate_gather_scatter_offset (stmt_vec_info stmt_info, tree vectype,
         get_object_alignment (DR_REF (dr)));
       gs_info->element_type = TREE_TYPE (vectype);
       gs_info->offset = fold_convert (offset_type, step);
-      gs_info->offset_dt = vect_constant_def;
       gs_info->scale = scale;
       gs_info->memory_type = memory_type;
       return true;
@@ -2229,22 +2228,23 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info,
     *memory_access_type = VMAT_GATHER_SCATTER;
   else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
     {
-      tree offset;
-      slp_tree offset_node;
       *memory_access_type = VMAT_GATHER_SCATTER;
       if (!vect_check_gather_scatter (stmt_info, loop_vinfo, gs_info,
                                      elsvals))
        gcc_unreachable ();
+      slp_tree offset_node = SLP_TREE_CHILDREN (slp_node)[0];
+      tree offset_vectype = SLP_TREE_VECTYPE (offset_node);
+      gs_info->offset_vectype = offset_vectype;
       /* When using internal functions, we rely on pattern recognition
         to convert the type of the offset to the type that the target
         requires, with the result being a call to an internal function.
         If that failed for some reason (e.g. because another pattern
         took priority), just handle cases in which the offset already
         has the right type.  */
-      else if (GATHER_SCATTER_IFN_P (*gs_info)
-              && !is_gimple_call (stmt_info->stmt)
-              && !tree_nop_conversion_p (TREE_TYPE (gs_info->offset),
-                                         TREE_TYPE (gs_info->offset_vectype)))
+      if (GATHER_SCATTER_IFN_P (*gs_info)
+         && !is_gimple_call (stmt_info->stmt)
+         && !tree_nop_conversion_p (TREE_TYPE (gs_info->offset),
+                                    offset_vectype))
        {
          if (dump_enabled_p ())
            dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -2252,23 +2252,12 @@ get_group_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 (vinfo, slp_node, 0, &offset, &offset_node,
-                                   &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 (GATHER_SCATTER_EMULATED_P (*gs_info))
        {
          if (!TYPE_VECTOR_SUBPARTS (vectype).is_constant ()
-             || !TYPE_VECTOR_SUBPARTS (gs_info->offset_vectype).is_constant ()
-             || VECTOR_BOOLEAN_TYPE_P (gs_info->offset_vectype)
-             || !constant_multiple_p (TYPE_VECTOR_SUBPARTS
-                                        (gs_info->offset_vectype),
+             || !TYPE_VECTOR_SUBPARTS (offset_vectype).is_constant ()
+             || VECTOR_BOOLEAN_TYPE_P (offset_vectype)
+             || !constant_multiple_p (TYPE_VECTOR_SUBPARTS (offset_vectype),
                                       TYPE_VECTOR_SUBPARTS (vectype)))
            {
              if (dump_enabled_p ())
index 4a1e4fc79e07245d5b1a26f53e6d56902f386ad1..203e5ad964a688f655fecf5a2b6d36c76e62f891 100644 (file)
@@ -1561,9 +1561,6 @@ struct gather_scatter_info {
      being added to the base.  */
   int scale;
 
-  /* The definition type for the vectorized offset.  */
-  enum vect_def_type offset_dt;
-
   /* The type of the vectorized offset.  */
   tree offset_vectype;