https://gcc.gnu.org/g:3b83232c672cd969ec1f7420da99f7a054554958

commit r16-3489-g3b83232c672cd969ec1f7420da99f7a054554958
Author: Richard Biener <rguent...@suse.de>
Date:   Wed Aug 27 15:20:03 2025 +0200

    Remove no longer needed STMT_VINFO_REDUC_DEF sets
    
    The following removes no longer needed extra sets of STMT_VINFO_REDUC_DEF
    and replaces a single remaining one with a more appropriate check.
    
            * tree-vect-loop.cc (vectorizable_live_operation): Check
            vect_is_reduction on the SLP node rather than
            STMT_VINFO_REDUC_DEF on the stmt.
            (vectorizable_reduction): Do not set STMT_VINFO_REDUC_DEF
            on live stmts.

Diff:
---
 gcc/tree-vect-loop.cc | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index d3e25a5e83c7..b9fc47693094 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7136,16 +7136,6 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
        }
       if (!REDUC_GROUP_FIRST_ELEMENT (vdef))
        only_slp_reduc_chain = false;
-      /* For epilogue generation live members of the chain need
-         to point back to the PHI via their original stmt for
-        info_for_reduction to work.  For SLP we need to look at
-        all lanes here - even though we only will vectorize from
-        the SLP node with live lane zero the other live lanes also
-        need to be identified as part of a reduction to be able
-        to skip code generation for them.  */
-      for (auto s : SLP_TREE_SCALAR_STMTS (vdef_slp))
-       if (STMT_VINFO_LIVE_P (s))
-         STMT_VINFO_REDUC_DEF (vect_orig_stmt (s)) = phi_info;
       gimple_match_op op;
       if (!gimple_extract_op (vdef->stmt, &op))
        {
@@ -7194,10 +7184,6 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
                    return false;
                }
 
-             /* For lane-reducing operation vectorizable analysis needs the
-                reduction PHI information.  */
-             STMT_VINFO_REDUC_DEF (def) = phi_info;
-
              /* 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
@@ -10233,7 +10219,7 @@ vectorizable_live_operation (vec_info *vinfo, 
stmt_vec_info stmt_info,
   /* If a stmt of a reduction is live, vectorize it via
      vect_create_epilog_for_reduction.  vectorizable_reduction assessed
      validity so just trigger the transform here.  */
-  if (STMT_VINFO_REDUC_DEF (vect_orig_stmt (stmt_info)))
+  if (vect_is_reduction (slp_node))
     {
       if (!vec_stmt_p)
        return true;

Reply via email to