diff options
author | Richard Biener <rguenther@suse.de> | 2022-02-18 11:50:44 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-02-22 07:48:38 +0100 |
commit | f24dfc76177b3994434c8beb287cde1a9976b5ce (patch) | |
tree | 198480fb098a52bf230d5e9e5b208fef8a58b2a7 /gcc/tree-vectorizer.h | |
parent | 61fc5e098e76c9809f35f449a70c9c8d74773d9d (diff) | |
download | gcc-f24dfc76177b3994434c8beb287cde1a9976b5ce.zip gcc-f24dfc76177b3994434c8beb287cde1a9976b5ce.tar.gz gcc-f24dfc76177b3994434c8beb287cde1a9976b5ce.tar.bz2 |
tree-optimization/104582 - make SLP node available in vector cost hook
This adjusts the vectorizer costing API to allow passing down the
SLP node the vector stmt is created from.
2022-02-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/104582
* tree-vectorizer.h (stmt_info_for_cost::node): New field.
(vector_costs::add_stmt_cost): Add SLP node parameter.
(dump_stmt_cost): Likewise.
(add_stmt_cost): Likewise, new overload and adjust.
(add_stmt_costs): Adjust.
(record_stmt_cost): New overload.
* tree-vectorizer.cc (dump_stmt_cost): Dump the SLP node.
(vector_costs::add_stmt_cost): Adjust.
* tree-vect-loop.cc (vect_estimate_min_profitable_iters):
Adjust.
* tree-vect-slp.cc (vect_prologue_cost_for_slp): Record
the SLP node for costing.
(vectorizable_slp_permutation): Likewise.
* tree-vect-stmts.cc (record_stmt_cost): Adjust and add
new overloads.
* config/i386/i386.cc (ix86_vector_costs::add_stmt_cost):
Adjust.
* config/aarch64/aarch64.cc (aarch64_vector_costs::add_stmt_cost):
Adjust.
* config/rs6000/rs6000.cc (rs6000_vector_costs::add_stmt_cost):
Adjust.
(rs6000_cost_data::adjust_vect_cost_per_loop): Likewise.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r-- | gcc/tree-vectorizer.h | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index da99f28..642eb0a 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see #define GCC_TREE_VECTORIZER_H typedef class _stmt_vec_info *stmt_vec_info; +typedef struct _slp_tree *slp_tree; #include "tree-data-ref.h" #include "tree-hash-traits.h" @@ -101,6 +102,7 @@ struct stmt_info_for_cost { enum vect_cost_for_stmt kind; enum vect_cost_model_location where; stmt_vec_info stmt_info; + slp_tree node; tree vectype; int misalign; }; @@ -151,7 +153,6 @@ struct vect_scalar_ops_slice_hash : typed_noop_remove<vect_scalar_ops_slice> /************************************************************************ SLP ************************************************************************/ -typedef struct _slp_tree *slp_tree; typedef vec<std::pair<unsigned, unsigned> > lane_permutation_t; typedef vec<unsigned> load_permutation_t; @@ -1462,7 +1463,7 @@ public: - WHERE specifies whether the cost occurs in the loop prologue, the loop body, or the loop epilogue. - KIND is the kind of statement, which is always meaningful. - - STMT_INFO, if nonnull, describes the statement that will be + - STMT_INFO or NODE, if nonnull, describe the statement that will be vectorized. - VECTYPE, if nonnull, is the vector type that the vectorized statement will operate on. Note that this should be used in @@ -1476,8 +1477,9 @@ public: Return the calculated cost as well as recording it. The return value is used for dumping purposes. */ virtual unsigned int add_stmt_cost (int count, vect_cost_for_stmt kind, - stmt_vec_info stmt_info, tree vectype, - int misalign, + stmt_vec_info stmt_info, + slp_tree node, + tree vectype, int misalign, vect_cost_model_location where); /* Finish calculating the cost of the code. The results can be @@ -1743,7 +1745,7 @@ init_cost (vec_info *vinfo, bool costing_for_scalar) } extern void dump_stmt_cost (FILE *, int, enum vect_cost_for_stmt, - stmt_vec_info, tree, int, unsigned, + stmt_vec_info, slp_tree, tree, int, unsigned, enum vect_cost_model_location); /* Alias targetm.vectorize.add_stmt_cost. */ @@ -1751,13 +1753,14 @@ extern void dump_stmt_cost (FILE *, int, enum vect_cost_for_stmt, static inline unsigned add_stmt_cost (vector_costs *costs, int count, enum vect_cost_for_stmt kind, - stmt_vec_info stmt_info, tree vectype, int misalign, + stmt_vec_info stmt_info, slp_tree node, + tree vectype, int misalign, enum vect_cost_model_location where) { - unsigned cost = costs->add_stmt_cost (count, kind, stmt_info, vectype, + unsigned cost = costs->add_stmt_cost (count, kind, stmt_info, node, vectype, misalign, where); if (dump_file && (dump_flags & TDF_DETAILS)) - dump_stmt_cost (dump_file, count, kind, stmt_info, vectype, misalign, + dump_stmt_cost (dump_file, count, kind, stmt_info, node, vectype, misalign, cost, where); return cost; } @@ -1768,7 +1771,7 @@ add_stmt_cost (vector_costs *costs, int count, enum vect_cost_for_stmt kind, { gcc_assert (kind == cond_branch_taken || kind == cond_branch_not_taken || kind == scalar_stmt); - return add_stmt_cost (costs, count, kind, NULL, NULL_TREE, 0, where); + return add_stmt_cost (costs, count, kind, NULL, NULL, NULL_TREE, 0, where); } /* Alias targetm.vectorize.add_stmt_cost. */ @@ -1776,7 +1779,7 @@ add_stmt_cost (vector_costs *costs, int count, enum vect_cost_for_stmt kind, static inline unsigned add_stmt_cost (vector_costs *costs, stmt_info_for_cost *i) { - return add_stmt_cost (costs, i->count, i->kind, i->stmt_info, + return add_stmt_cost (costs, i->count, i->kind, i->stmt_info, i->node, i->vectype, i->misalign, i->where); } @@ -1802,7 +1805,7 @@ add_stmt_costs (vector_costs *costs, stmt_vector_for_cost *cost_vec) unsigned i; FOR_EACH_VEC_ELT (*cost_vec, i, cost) add_stmt_cost (costs, cost->count, cost->kind, cost->stmt_info, - cost->vectype, cost->misalign, cost->where); + cost->node, cost->vectype, cost->misalign, cost->where); } /*-----------------------------------------------------------------*/ @@ -2130,6 +2133,9 @@ extern unsigned record_stmt_cost (stmt_vector_for_cost *, int, enum vect_cost_for_stmt, stmt_vec_info, tree, int, enum vect_cost_model_location); extern unsigned record_stmt_cost (stmt_vector_for_cost *, int, + enum vect_cost_for_stmt, slp_tree, + tree, int, enum vect_cost_model_location); +extern unsigned record_stmt_cost (stmt_vector_for_cost *, int, enum vect_cost_for_stmt, enum vect_cost_model_location); |