This should be present only on SLP nodes now.  The RISC-V changes
are mechanical along the line of the SLP_TREE_TYPE changes.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.  The
update_epilogue_loop_vinfo change might require changes to strided
load handling, so I'll possibly defer this change to after refactoring
of the gather/scatter changes.  But hopefully it goes clean ...

        * tree-vectorizer.h (_stmt_vec_info::memory_access_type): Remove.
        (STMT_VINFO_MEMORY_ACCESS_TYPE): Likewise.
        (vect_mem_access_type): Always access SLP node.
        * tree-vect-stmts.cc (vectorizable_store): Do not set
        STMT_VINFO_MEMORY_ACCESS_TYPE.  Fix SLP_TREE_MEMORY_ACCESS_TYPE
        usage.
        * tree-vect-loop.cc (update_epilogue_loop_vinfo): Remove
        checking of memory access type.
        * config/riscv/riscv-vector-costs.cc (costs::compute_local_live_ranges):
        Use SLP_TREE_MEMORY_ACCESS_TYPE.
        (costs::need_additional_vector_vars_p): Likewise.
        (segment_loadstore_group_size): Get SLP node as argument,
        use SLP_TREE_MEMORY_ACCESS_TYPE.
        (costs::adjust_stmt_cost): Pass down SLP node.
---
 gcc/config/riscv/riscv-vector-costs.cc | 16 ++++++++--------
 gcc/tree-vect-loop.cc                  |  6 ++----
 gcc/tree-vect-stmts.cc                 |  3 +--
 gcc/tree-vectorizer.h                  | 12 ++----------
 4 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/gcc/config/riscv/riscv-vector-costs.cc 
b/gcc/config/riscv/riscv-vector-costs.cc
index 1c6bc25c2ad..44ef44a1435 100644
--- a/gcc/config/riscv/riscv-vector-costs.cc
+++ b/gcc/config/riscv/riscv-vector-costs.cc
@@ -400,7 +400,7 @@ costs::compute_local_live_ranges (
                  pair &live_range
                    = live_ranges->get_or_insert (lhs, &existed_p);
                  gcc_assert (!existed_p);
-                 if (STMT_VINFO_MEMORY_ACCESS_TYPE (program_point.stmt_info)
+                 if (SLP_TREE_MEMORY_ACCESS_TYPE (*node)
                      == VMAT_LOAD_STORE_LANES)
                    point = get_first_lane_point (program_points,
                                                  program_point.stmt_info);
@@ -418,8 +418,7 @@ costs::compute_local_live_ranges (
                      bool existed_p = false;
                      pair &live_range
                        = live_ranges->get_or_insert (var, &existed_p);
-                     if (STMT_VINFO_MEMORY_ACCESS_TYPE (
-                           program_point.stmt_info)
+                     if (SLP_TREE_MEMORY_ACCESS_TYPE (*node)
                          == VMAT_LOAD_STORE_LANES)
                        point = get_last_lane_point (program_points,
                                                     program_point.stmt_info);
@@ -608,7 +607,7 @@ costs::need_additional_vector_vars_p (stmt_vec_info 
stmt_info,
   if (type == load_vec_info_type || type == store_vec_info_type)
     {
       if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)
-         && STMT_VINFO_MEMORY_ACCESS_TYPE (stmt_info) == VMAT_GATHER_SCATTER)
+         && SLP_TREE_MEMORY_ACCESS_TYPE (node) == VMAT_GATHER_SCATTER)
        return true;
 
       machine_mode mode = TYPE_MODE (STMT_VINFO_VECTYPE (stmt_info));
@@ -1086,7 +1085,7 @@ costs::better_main_loop_than_p (const vector_costs 
*uncast_other) const
    load/store.  */
 static int
 segment_loadstore_group_size (enum vect_cost_for_stmt kind,
-                             stmt_vec_info stmt_info)
+                             stmt_vec_info stmt_info, slp_tree node)
 {
   if (stmt_info
       && (kind == vector_load || kind == vector_store)
@@ -1094,7 +1093,7 @@ segment_loadstore_group_size (enum vect_cost_for_stmt 
kind,
     {
       stmt_info = DR_GROUP_FIRST_ELEMENT (stmt_info);
       if (stmt_info
-         && STMT_VINFO_MEMORY_ACCESS_TYPE (stmt_info) == VMAT_LOAD_STORE_LANES)
+         && SLP_TREE_MEMORY_ACCESS_TYPE (node) == VMAT_LOAD_STORE_LANES)
        return DR_GROUP_SIZE (stmt_info);
     }
   return 0;
@@ -1108,7 +1107,7 @@ segment_loadstore_group_size (enum vect_cost_for_stmt 
kind,
 unsigned
 costs::adjust_stmt_cost (enum vect_cost_for_stmt kind, loop_vec_info loop,
                         stmt_vec_info stmt_info,
-                        slp_tree, tree vectype, int stmt_cost)
+                        slp_tree node, tree vectype, int stmt_cost)
 {
   const cpu_vector_cost *costs = get_vector_costs ();
   switch (kind)
@@ -1131,7 +1130,8 @@ costs::adjust_stmt_cost (enum vect_cost_for_stmt kind, 
loop_vec_info loop,
                 each vector in the group.  Here we additionally add permute
                 costs for each.  */
              /* TODO: Indexed and ordered/unordered cost.  */
-             int group_size = segment_loadstore_group_size (kind, stmt_info);
+             int group_size = segment_loadstore_group_size (kind, stmt_info,
+                                                            node);
              if (group_size > 1)
                {
                  switch (group_size)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index aa6fa218a0b..45e03494a85 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -11235,11 +11235,9 @@ update_epilogue_loop_vinfo (class loop *epilogue, tree 
advance)
         updated offset we set using ADVANCE.  Instead we have to make sure the
         reference in the data references point to the corresponding copy of
         the original in the epilogue.  Make sure to update both
-        gather/scatters recognized by dataref analysis and also other
-        refs that get_load_store_type classified as VMAT_GATHER_SCATTER.  */
+        gather/scatters recognized by dataref analysis.  */
       auto vstmt_vinfo = vect_stmt_to_vectorize (stmt_vinfo);
-      if (STMT_VINFO_MEMORY_ACCESS_TYPE (vstmt_vinfo) == VMAT_GATHER_SCATTER
-         || STMT_VINFO_STRIDED_P (vstmt_vinfo)
+      if (STMT_VINFO_STRIDED_P (vstmt_vinfo)
          || STMT_VINFO_GATHER_SCATTER_P (vstmt_vinfo))
        {
          /* ???  As we copy epilogues from the main loop incremental
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 20a4bb2b3d3..5a01a809d9b 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -7945,7 +7945,6 @@ vectorizable_store (vec_info *vinfo,
   bool costing_p = cost_vec;
   if (costing_p) /* transformation not required.  */
     {
-      STMT_VINFO_MEMORY_ACCESS_TYPE (stmt_info) = memory_access_type;
       SLP_TREE_MEMORY_ACCESS_TYPE (slp_node) = memory_access_type;
 
       if (loop_vinfo
@@ -7976,7 +7975,7 @@ vectorizable_store (vec_info *vinfo,
 
       SLP_TREE_TYPE (slp_node) = store_vec_info_type;
     }
-  gcc_assert (memory_access_type == SLP_TREE_MEMORY_ACCESS_TYPE (stmt_info));
+  gcc_assert (memory_access_type == SLP_TREE_MEMORY_ACCESS_TYPE (slp_node));
 
   /* Transform.  */
 
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 2ca6c349017..1db344bbffd 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1437,10 +1437,6 @@ public:
   /* For both loads and stores.  */
   unsigned simd_lane_access_p : 3;
 
-  /* Classifies how the load or store is going to be implemented
-     for loop vectorization.  */
-  vect_memory_access_type memory_access_type;
-
   /* For INTEGER_INDUC_COND_REDUCTION, the initial value to be used.  */
   tree induc_cond_initial_val;
 
@@ -1586,7 +1582,6 @@ struct gather_scatter_info {
 #define STMT_VINFO_DATA_REF(S)             ((S)->dr_aux.dr + 0)
 #define STMT_VINFO_GATHER_SCATTER_P(S)    (S)->gather_scatter_p
 #define STMT_VINFO_STRIDED_P(S)                   (S)->strided_p
-#define STMT_VINFO_MEMORY_ACCESS_TYPE(S)   (S)->memory_access_type
 #define STMT_VINFO_SIMD_LANE_ACCESS_P(S)   (S)->simd_lane_access_p
 #define STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL(S) (S)->induc_cond_initial_val
 #define STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT(S) (S)->reduc_epilogue_adjustment
@@ -2831,12 +2826,9 @@ vect_is_reduction (stmt_vec_info stmt_info)
    SLP this is read from NODE, otherwise it's read from the STMT_VINFO.  */
 
 inline vect_memory_access_type
-vect_mem_access_type (stmt_vec_info stmt_info, slp_tree node)
+vect_mem_access_type (stmt_vec_info, slp_tree node)
 {
-  if (node)
-    return SLP_TREE_MEMORY_ACCESS_TYPE (node);
-  else
-    return STMT_VINFO_MEMORY_ACCESS_TYPE (stmt_info);
+  return SLP_TREE_MEMORY_ACCESS_TYPE (node);
 }
 
 /* If STMT_INFO describes a reduction, return the vect_reduction_type
-- 
2.43.0

Reply via email to