]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Pass SLP node to promotion/demotion costing
authorRichard Biener <rguenther@suse.de>
Thu, 7 Aug 2025 12:45:52 +0000 (14:45 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 8 Aug 2025 07:05:00 +0000 (09:05 +0200)
This one was forgotten.  Also constants/externals are costed explicitly
with SLP.

* tree-vect-stmts.cc (vect_model_promotion_demotion_cost): Pass
in SLP node and drop unused dr argument.  Use SLP node for
costing, drop costing of constant/external operands.
(vectorizable_conversion): Adjust.

gcc/tree-vect-stmts.cc

index 92bda1c20cf3c96386d94e440e43adb105f6854e..eff5e88930816ebddaf2e515904601b3b8a0819f 100644 (file)
@@ -929,8 +929,7 @@ vect_model_simple_cost (vec_info *, int n, slp_tree node,
    is true the stmt is doing widening arithmetic.  */
 
 static void
-vect_model_promotion_demotion_cost (stmt_vec_info stmt_info,
-                                   enum vect_def_type *dt,
+vect_model_promotion_demotion_cost (slp_tree slp_node,
                                    unsigned int ncopies, int pwr,
                                    stmt_vector_for_cost *cost_vec,
                                    bool widen_arith)
@@ -943,16 +942,10 @@ vect_model_promotion_demotion_cost (stmt_vec_info stmt_info,
       inside_cost += record_stmt_cost (cost_vec, ncopies,
                                       widen_arith
                                       ? vector_stmt : vec_promote_demote,
-                                      stmt_info, 0, vect_body);
+                                      slp_node, 0, vect_body);
       ncopies *= 2;
     }
 
-  /* FORNOW: Assuming maximum 2 args per stmts.  */
-  for (i = 0; i < 2; i++)
-    if (dt[i] == vect_constant_def || dt[i] == vect_external_def)
-      prologue_cost += record_stmt_cost (cost_vec, 1, vector_stmt,
-                                        stmt_info, 0, vect_prologue);
-
   if (dump_enabled_p ())
     dump_printf_loc (MSG_NOTE, vect_location,
                      "vect_model_promotion_demotion_cost: inside_cost = %d, "
@@ -5386,7 +5379,7 @@ vectorizable_conversion (vec_info *vinfo,
          SLP_TREE_TYPE (slp_node) = type_demotion_vec_info_type;
          /* The final packing step produces one vector result per copy.  */
          unsigned int nvectors = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
-         vect_model_promotion_demotion_cost (stmt_info, dt, nvectors,
+         vect_model_promotion_demotion_cost (slp_node, nvectors,
                                              multi_step_cvt, cost_vec,
                                              widen_arith);
        }
@@ -5398,7 +5391,7 @@ vectorizable_conversion (vec_info *vinfo,
             so >> MULTI_STEP_CVT divides by 2^(number of steps - 1).  */
          unsigned int nvectors
            = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node) >> multi_step_cvt;
-         vect_model_promotion_demotion_cost (stmt_info, dt, nvectors,
+         vect_model_promotion_demotion_cost (slp_node, nvectors,
                                              multi_step_cvt, cost_vec,
                                              widen_arith);
        }