aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2021-11-10 12:31:01 +0000
committerRichard Sandiford <richard.sandiford@arm.com>2021-11-10 12:31:01 +0000
commit6ddc6a57a74c3a388eb1626e59005f54c6e66c57 (patch)
treead74173fbfebe5e04d3a357472cc5161ffd1611f /gcc/tree-vectorizer.h
parent5720a9d5beacb558c1ddccbbfef9f9e4f91b14cf (diff)
downloadgcc-6ddc6a57a74c3a388eb1626e59005f54c6e66c57.zip
gcc-6ddc6a57a74c3a388eb1626e59005f54c6e66c57.tar.gz
gcc-6ddc6a57a74c3a388eb1626e59005f54c6e66c57.tar.bz2
vect: Keep scalar costs around longer
The scalar costs for a loop are fleeting, with only the final single_scalar_iteration_cost being kept for later comparison. This patch replaces single_scalar_iteration_cost with the cost structure, so that (with later patches) it's possible for targets to examine other target-specific cost properties as well. This will be done by passing the scalar costs to hooks where appropriate; targets shouldn't try to read the information directly from loop_vec_infos. gcc/ * tree-vectorizer.h (_loop_vec_info::scalar_costs): New member variable. (_loop_vec_info::single_scalar_iteration_cost): Delete. (LOOP_VINFO_SINGLE_SCALAR_ITERATION_COST): Delete. (vector_costs::total_cost): New function. * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Update after above changes. (_loop_vec_info::~_loop_vec_info): Delete scalar_costs. (vect_compute_single_scalar_iteration_cost): Store the costs in loop_vinfo->scalar_costs. (vect_estimate_min_profitable_iters): Get the scalar cost from loop_vinfo->scalar_costs.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r--gcc/tree-vectorizer.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 9b41995..a8ce308 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -590,6 +590,9 @@ public:
/* The cost of the vector code. */
class vector_costs *vector_costs;
+ /* The cost of the scalar code. */
+ class vector_costs *scalar_costs;
+
/* Threshold of number of iterations below which vectorization will not be
performed. It is calculated from MIN_PROFITABLE_ITERS and
param_min_vect_loop_bound. */
@@ -721,9 +724,6 @@ public:
applied to the loop, i.e., no unrolling is needed, this is 1. */
poly_uint64 slp_unrolling_factor;
- /* Cost of a single scalar iteration. */
- int single_scalar_iteration_cost;
-
/* The factor used to over weight those statements in an inner loop
relative to the loop being vectorized. */
unsigned int inner_loop_cost_factor;
@@ -843,7 +843,6 @@ public:
#define LOOP_VINFO_SCALAR_LOOP_SCALING(L) (L)->scalar_loop_scaling
#define LOOP_VINFO_HAS_MASK_STORE(L) (L)->has_mask_store
#define LOOP_VINFO_SCALAR_ITERATION_COST(L) (L)->scalar_cost_vec
-#define LOOP_VINFO_SINGLE_SCALAR_ITERATION_COST(L) (L)->single_scalar_iteration_cost
#define LOOP_VINFO_ORIG_LOOP_INFO(L) (L)->orig_loop_info
#define LOOP_VINFO_SIMD_IF_COND(L) (L)->simd_if_cond
#define LOOP_VINFO_INNER_LOOP_COST_FACTOR(L) (L)->inner_loop_cost_factor
@@ -1438,6 +1437,7 @@ public:
unsigned int body_cost () const;
unsigned int epilogue_cost () const;
unsigned int outside_cost () const;
+ unsigned int total_cost () const;
protected:
unsigned int record_stmt_cost (stmt_vec_info, vect_cost_model_location,
@@ -1508,6 +1508,15 @@ vector_costs::outside_cost () const
return prologue_cost () + epilogue_cost ();
}
+/* Return the cost of the prologue, body and epilogue code
+ (in abstract units). */
+
+inline unsigned int
+vector_costs::total_cost () const
+{
+ return body_cost () + outside_cost ();
+}
+
#define VECT_MAX_COST 1000
/* The maximum number of intermediate steps required in multi-step type