From 0612883d9dc6eebecdbe937893b86597acae237c Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 10 Nov 2021 12:31:02 +0000 Subject: vect: Pass scalar_costs to finish_cost When finishing the vector costs, it can be useful to know what the associated scalar costs were. This allows targets to read information collected about the original scalar loop when trying to make a final judgement about the cost of the vector code. This patch therefore passes the scalar costs to vector_costs::finish_cost. The parameter is null for the scalar costs themselves. gcc/ * tree-vectorizer.h (vector_costs::finish_cost): Take the corresponding scalar costs as a parameter. (finish_cost): Likewise. * tree-vect-loop.c (vect_compute_single_scalar_iteration_cost) (vect_estimate_min_profitable_iters): Update accordingly. * tree-vect-slp.c (vect_bb_vectorization_profitable_p): Likewise. * tree-vectorizer.c (vector_costs::finish_cost): Likewise. * config/aarch64/aarch64.c (aarch64_vector_costs::finish_cost): Likewise. * config/rs6000/rs6000.c (rs6000_cost_data::finish_cost): Likewise. --- gcc/config/rs6000/rs6000.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/config/rs6000/rs6000.c') diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 1f2aa60..e4843eb 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -5268,7 +5268,7 @@ public: stmt_vec_info stmt_info, tree vectype, int misalign, vect_cost_model_location where) override; - void finish_cost () override; + void finish_cost (const vector_costs *) override; protected: void update_target_cost_per_stmt (vect_cost_for_stmt, stmt_vec_info, @@ -5522,7 +5522,7 @@ rs6000_cost_data::adjust_vect_cost_per_loop (loop_vec_info loop_vinfo) } void -rs6000_cost_data::finish_cost () +rs6000_cost_data::finish_cost (const vector_costs *scalar_costs) { if (loop_vec_info loop_vinfo = dyn_cast (m_vinfo)) { @@ -5539,7 +5539,7 @@ rs6000_cost_data::finish_cost () m_costs[vect_body] += 10000; } - vector_costs::finish_cost (); + vector_costs::finish_cost (scalar_costs); } /* Implement targetm.loop_unroll_adjust. */ -- cgit v1.1