Remove vectorizer finish_cost wrapper

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.

	* 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.
This commit is contained in:
Richard Biener 2024-10-30 13:06:08 +01:00 committed by Richard Biener
parent 875279ff3e
commit 8f9348361c
3 changed files with 14 additions and 26 deletions

View File

@ -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

View File

@ -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;

View File

@ -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)
{