]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Remove no longer needed STMT_VINFO_REDUC_DEF sets
authorRichard Biener <rguenther@suse.de>
Wed, 27 Aug 2025 13:20:03 +0000 (15:20 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 1 Sep 2025 12:04:24 +0000 (14:04 +0200)
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.

gcc/tree-vect-loop.cc

index d3e25a5e83c7a15e9034f23a3c3f20cd7bea9bd9..b9fc476930947d57303d1dec71b2884966ea3a03 100644 (file)
@@ -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;