https://gcc.gnu.org/g:0240c52eb6772c3139dfd27fc8fd4ac73c1014b2

commit r16-3387-g0240c52eb6772c3139dfd27fc8fd4ac73c1014b2
Author: Richard Biener <rguent...@suse.de>
Date:   Mon Aug 25 14:40:27 2025 +0200

    Remove STMT_VINFO_REDUC_VECTYPE_IN
    
    This was added when invariants/externals outside of SLP didn't have
    an easily accessible vector type.  Now it's redundant so the
    following removes it.
    
            * tree-vectorizer.h (stmt_vec_info_::reduc_vectype_in): Remove.
            (STMT_VINFO_REDUC_VECTYPE_IN): Likewise.
            * tree-vect-loop.cc (vect_is_emulated_mixed_dot_prod): Get
            at the input vectype via the SLP node child.
            (vectorizable_lane_reducing): Likewise.
            (vect_transform_reduction): Likewise.
            (vectorizable_reduction): Do not set STMT_VINFO_REDUC_VECTYPE_IN.

Diff:
---
 gcc/tree-vect-loop.cc | 19 +++++--------------
 gcc/tree-vectorizer.h |  3 ---
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index aab375a4d11c..2bea904de82a 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -4798,10 +4798,10 @@ vect_is_emulated_mixed_dot_prod (slp_tree slp_node)
   if (TYPE_SIGN (TREE_TYPE (rhs1)) == TYPE_SIGN (TREE_TYPE (rhs2)))
     return false;
 
-  gcc_assert (STMT_VINFO_REDUC_VECTYPE_IN (stmt_info));
   return !directly_supported_p (DOT_PROD_EXPR,
                                SLP_TREE_VECTYPE (slp_node),
-                               STMT_VINFO_REDUC_VECTYPE_IN (stmt_info),
+                               SLP_TREE_VECTYPE
+                                 (SLP_TREE_CHILDREN (slp_node)[0]),
                                optab_vector_mixed_sign);
 }
 
@@ -6934,8 +6934,7 @@ vectorizable_lane_reducing (loop_vec_info loop_vinfo, 
stmt_vec_info stmt_info,
        return false;
     }
 
-  tree vectype_in = STMT_VINFO_REDUC_VECTYPE_IN (stmt_info);
-
+  tree vectype_in = SLP_TREE_VECTYPE (SLP_TREE_CHILDREN (slp_node)[0]);
   gcc_assert (vectype_in);
 
   /* Compute number of effective vector statements for costing.  */
@@ -7207,11 +7206,6 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
                 reduction PHI information.  */
              STMT_VINFO_REDUC_DEF (def) = phi_info;
 
-             /* Each lane-reducing operation has its own input vectype, while
-                reduction PHI will record the input vectype with the least
-                lanes.  */
-             STMT_VINFO_REDUC_VECTYPE_IN (vdef) = vectype_op;
-
              /* To accommodate lane-reducing operations of mixed input
                 vectypes, choose input vectype with the least lanes for the
                 reduction PHI statement, which would result in the most
@@ -8025,10 +8019,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo,
   stmt_vec_info phi_info = STMT_VINFO_REDUC_DEF (vect_orig_stmt (stmt_info));
   gphi *reduc_def_phi = as_a <gphi *> (phi_info->stmt);
   int reduc_index = STMT_VINFO_REDUC_IDX (stmt_info);
-  tree vectype_in = STMT_VINFO_REDUC_VECTYPE_IN (stmt_info);
-
-  if (!vectype_in)
-    vectype_in = SLP_TREE_VECTYPE (slp_node);
+  tree vectype_in = SLP_TREE_VECTYPE (SLP_TREE_CHILDREN (slp_node)[0]);
 
   vec_num = vect_get_num_copies (loop_vinfo, slp_node, vectype_in);
 
@@ -8205,7 +8196,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo,
            }
        }
 
-      tree reduc_vectype_in = STMT_VINFO_REDUC_VECTYPE_IN (stmt_info);
+      tree reduc_vectype_in = vectype_in;
       gcc_assert (reduc_vectype_in);
 
       unsigned effec_reduc_ncopies
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 729fa8227753..67154d3eaf52 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1518,9 +1518,6 @@ public:
      corresponding PHI.  */
   stmt_vec_info reduc_def;
 
-  /* The vector input type relevant for reduction vectorization.  */
-  tree reduc_vectype_in;
-
   /* The vector type for performing the actual reduction.  */
   tree reduc_vectype;

Reply via email to