The inline function wraps the vector_cost class API and no longer is
a good representation of the query style of that class which makes it
also difficult to extend.
Boostrapped and tested on x86_64-unknown-linux-gnu, pushed.
* tree-vectorizer.h (finish_cost): Inline everywhere and remove.
* tree-vect-loop.cc (vect_estimate_min_profitable_iters):
Inline finish_cost.
* tree-vect-slp.cc (vect_bb_vectorization_profitable_p): Likewise.
---
gcc/tree-vect-loop.cc | 10 +++++++---
gcc/tree-vect-slp.cc | 11 ++++++-----
gcc/tree-vectorizer.h | 19 +------------------
3 files changed, 14 insertions(+), 26 deletions(-)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index b8e155b90f8..df89edac036 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -4984,9 +4984,13 @@ vect_estimate_min_profitable_iters (loop_vec_info
loop_vinfo,
}
/* Complete the target-specific cost calculations. */
- finish_cost (loop_vinfo->vector_costs, loop_vinfo->scalar_costs,
- &vec_prologue_cost, &vec_inside_cost, &vec_epilogue_cost,
- suggested_unroll_factor);
+ loop_vinfo->vector_costs->finish_cost (loop_vinfo->scalar_costs);
+ vec_prologue_cost = loop_vinfo->vector_costs->prologue_cost ();
+ vec_inside_cost = loop_vinfo->vector_costs->body_cost ();
+ vec_epilogue_cost = loop_vinfo->vector_costs->epilogue_cost ();
+ if (suggested_unroll_factor)
+ *suggested_unroll_factor
+ = loop_vinfo->vector_costs->suggested_unroll_factor ();
if (suggested_unroll_factor && *suggested_unroll_factor > 1
&& LOOP_VINFO_MAX_VECT_FACTOR (loop_vinfo) != MAX_VECTORIZATION_FACTOR
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index a7f064bb0ed..21fd4c8dc09 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -8859,9 +8859,8 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
}
while (si < li_scalar_costs.length ()
&& li_scalar_costs[si].first == sl);
- unsigned dummy;
- finish_cost (scalar_target_cost_data, nullptr,
- &dummy, &scalar_cost, &dummy);
+ scalar_target_cost_data->finish_cost (nullptr);
+ scalar_cost = scalar_target_cost_data->body_cost ();
/* Complete the target-specific vector cost calculation. */
class vector_costs *vect_target_cost_data = init_cost (bb_vinfo, false);
@@ -8872,8 +8871,10 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
}
while (vi < li_vector_costs.length ()
&& li_vector_costs[vi].first == vl);
- finish_cost (vect_target_cost_data, scalar_target_cost_data,
- &vec_prologue_cost, &vec_inside_cost, &vec_epilogue_cost);
+ vect_target_cost_data->finish_cost (scalar_target_cost_data);
+ vec_prologue_cost = vect_target_cost_data->prologue_cost ();
+ vec_inside_cost = vect_target_cost_data->body_cost ();
+ vec_epilogue_cost = vect_target_cost_data->epilogue_cost ();
delete scalar_target_cost_data;
delete vect_target_cost_data;
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index b51771f836c..24227a69d4a 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1897,7 +1897,7 @@ extern void dump_stmt_cost (FILE *, int, enum
vect_cost_for_stmt,
stmt_vec_info, slp_tree, tree, int, unsigned,
enum vect_cost_model_location);
-/* Alias targetm.vectorize.add_stmt_cost. */
+/* Dump and add costs. */
inline unsigned
add_stmt_cost (vector_costs *costs, int count,
@@ -1923,8 +1923,6 @@ add_stmt_cost (vector_costs *costs, int count, enum
vect_cost_for_stmt kind,
return add_stmt_cost (costs, count, kind, NULL, NULL, NULL_TREE, 0, where);
}
-/* Alias targetm.vectorize.add_stmt_cost. */
-
inline unsigned
add_stmt_cost (vector_costs *costs, stmt_info_for_cost *i)
{
@@ -1932,21 +1930,6 @@ add_stmt_cost (vector_costs *costs, stmt_info_for_cost
*i)
i->vectype, i->misalign, i->where);
}
-/* Alias targetm.vectorize.finish_cost. */
-
-inline void
-finish_cost (vector_costs *costs, const vector_costs *scalar_costs,
- unsigned *prologue_cost, unsigned *body_cost,
- unsigned *epilogue_cost, unsigned *suggested_unroll_factor = NULL)
-{
- costs->finish_cost (scalar_costs);
- *prologue_cost = costs->prologue_cost ();
- *body_cost = costs->body_cost ();
- *epilogue_cost = costs->epilogue_cost ();
- if (suggested_unroll_factor)
- *suggested_unroll_factor = costs->suggested_unroll_factor ();
-}
-
inline void
add_stmt_costs (vector_costs *costs, stmt_vector_for_cost *cost_vec)
{
--
2.43.0