This one was forgotten.  Also constants/externals are costed explicitly
with SLP.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

         * 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 | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index b54893e98ed..a953b1747df 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -936,8 +936,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)
@@ -950,16 +949,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, "
@@ -5395,7 +5388,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);
        }
@@ -5407,7 +5400,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);
        }
-- 
2.43.0

Reply via email to