https://gcc.gnu.org/g:9f3003fe7223765ea9ba285a1edecb15f6b5cb65

commit r17-2114-g9f3003fe7223765ea9ba285a1edecb15f6b5cb65
Author: Richard Biener <[email protected]>
Date:   Fri Jul 3 13:18:43 2026 +0200

    Make BB SLP costing more verbose
    
    The following also dumps the costs for parts of the SLP graph that
    are associated with another loop when there's one that was not
    profitable.  It also prints markers to where scalar/vector parts
    start for easier debugging.
    
            * tree-vect-slp.cc (vect_bb_vectorization_profitable_p): Make
            profitabilty decision easier to debug.

Diff:
---
 gcc/tree-vect-slp.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 2250f6f74a1a..6081948fed4f 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -9695,6 +9695,9 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
          continue;
        }
 
+      if (dump_enabled_p ())
+       dump_printf_loc (MSG_NOTE, vect_location,
+                        "Scalar cost for part in loop %d\n", sl);
       class vector_costs *scalar_target_cost_data = init_cost (bb_vinfo, true);
       do
        {
@@ -9707,6 +9710,9 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
       scalar_cost = scalar_target_cost_data->body_cost ();
 
       /* Complete the target-specific vector cost calculation.  */
+      if (dump_enabled_p ())
+       dump_printf_loc (MSG_NOTE, vect_location,
+                        "Vector cost for part in loop %d\n", vl);
       class vector_costs *vect_target_cost_data = init_cost (bb_vinfo, false);
       auto_vec<stmt_info_for_cost> tem;
       do
@@ -9741,10 +9747,7 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
         free on the scalar side but cost a load on the vector side for
         example).  */
       if (vec_outside_cost + vec_inside_cost > scalar_cost)
-       {
-         profitable = false;
-         break;
-       }
+       profitable = false;
     }
   if (profitable && vi < li_vector_costs.length ())
     {

Reply via email to