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

commit r16-3283-g3bc63918cec91b0e1cd40ed7d4990a93f254678e
Author: Richard Biener <rguent...@suse.de>
Date:   Tue Aug 19 12:52:39 2025 +0200

    A few missing SLP node passings to vector costing
    
    The following fixes another few missed cases to pass a SLP node
    instead of a stmt_info.
    
            * tree-vect-loop.cc (vectorizable_reduction): Pass the
            appropriate SLP node for costing of single-def-use-cycle
            operations.
            (vectorizable_live_operation): Pass the SLP node to the
            costing hook.
            * tree-vect-stmts.cc (vectorizable_bswap): Likewise.
            (vectorizable_store): Likewise.

Diff:
---
 gcc/tree-vect-loop.cc  | 5 +++--
 gcc/tree-vect-stmts.cc | 6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 006fe980172b..0df0d774efc6 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7892,7 +7892,8 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
      vect_transform_reduction for non-lane-reducing operation.  Otherwise
      this is costed by the separate vectorizable_* routines.  */
   if (single_defuse_cycle)
-    record_stmt_cost (cost_vec, ncopies, vector_stmt, stmt_info, 0, vect_body);
+    record_stmt_cost (cost_vec, ncopies, vector_stmt,
+                     slp_for_stmt_info, 0, vect_body);
 
   if (dump_enabled_p ()
       && reduction_type == FOLD_LEFT_REDUCTION)
@@ -10378,7 +10379,7 @@ vectorizable_live_operation (vec_info *vinfo, 
stmt_vec_info stmt_info,
        }
       /* ???  Enable for loop costing as well.  */
       if (!loop_vinfo)
-       record_stmt_cost (cost_vec, 1, vec_to_scalar, stmt_info, NULL_TREE,
+       record_stmt_cost (cost_vec, 1, vec_to_scalar, slp_node,
                          0, vect_epilogue);
       return true;
     }
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 675c6e2e683c..33f1dfd48578 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -3107,10 +3107,10 @@ vectorizable_bswap (vec_info *vinfo,
       SLP_TREE_TYPE (slp_node) = call_vec_info_type;
       DUMP_VECT_SCOPE ("vectorizable_bswap");
       record_stmt_cost (cost_vec,
-                       1, vector_stmt, stmt_info, 0, vect_prologue);
+                       1, vector_stmt, slp_node, 0, vect_prologue);
       record_stmt_cost (cost_vec,
                        SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node),
-                       vec_perm, stmt_info, 0, vect_body);
+                       vec_perm, slp_node, 0, vect_body);
       return true;
     }
 
@@ -7940,7 +7940,7 @@ vectorizable_store (vec_info *vinfo,
          unsigned int inside_cost = 0, prologue_cost = 0;
          if (vls_type == VLS_STORE_INVARIANT)
            prologue_cost += record_stmt_cost (cost_vec, 1, scalar_to_vec,
-                                              stmt_info, 0, vect_prologue);
+                                              slp_node, 0, vect_prologue);
          vect_get_store_cost (vinfo, stmt_info, slp_node, 1,
                               alignment_support_scheme, misalignment,
                               &inside_cost, cost_vec);

Reply via email to