diff options
author | Tamar Christina <tamar.christina@arm.com> | 2024-11-21 12:49:35 +0000 |
---|---|---|
committer | Tamar Christina <tamar.christina@arm.com> | 2024-11-21 12:49:35 +0000 |
commit | dbc38dd9e96a9995298da2478041bdbbf247c479 (patch) | |
tree | 3e96b94f49cf72acbd0a46157b96444e38adce7b /gcc/tree-vectorizer.h | |
parent | 116b1c5489d12313f015c9ffd46b9394d559709d (diff) | |
download | gcc-dbc38dd9e96a9995298da2478041bdbbf247c479.zip gcc-dbc38dd9e96a9995298da2478041bdbbf247c479.tar.gz gcc-dbc38dd9e96a9995298da2478041bdbbf247c479.tar.bz2 |
middle-end: Pass along SLP node when costing vector loads/stores
With the support to SLP only we now pass the VMAT through the SLP node, however
the majority of the costing calls inside vectorizable_load and
vectorizable_store do no pass the SLP node along. Due to this the backend costing
never sees the VMAT for these cases anymore.
Additionally the helper around record_stmt_cost when both SLP and stmt_vinfo are
passed would only pass the SLP node along. However the SLP node doesn't contain
all the info available in the stmt_vinfo and we'd have to go through the
SLP_TREE_REPRESENTATIVE anyway. As such I changed the function to just Always
pass both along. Unlike the VMAT changes, I don't believe there to be a
correctness issue here but would minimize the number of churn in the backend
costing until vectorizer costing as a whole is revisited in GCC 16.
These changes re-enable the cost model on AArch64 and also correctly find the
VMATs on loads and stores fixing testcases such as sve_iters_low_2.c.
gcc/ChangeLog:
* tree-vect-data-refs.cc (vect_get_data_access_cost): Pass NULL for SLP
node.
* tree-vect-stmts.cc (record_stmt_cost): Expose.
(vect_get_store_cost, vect_get_load_cost): Extend with SLP node.
(vectorizable_store, vectorizable_load): Pass SLP node to all costing.
* tree-vectorizer.h (record_stmt_cost): Always pass both SLP node and
stmt_vinfo to costing.
(vect_get_load_cost, vect_get_store_cost): Extend with SLP node.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r-- | gcc/tree-vectorizer.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index dcad41d..7f69a3f 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2354,6 +2354,10 @@ extern unsigned record_stmt_cost (stmt_vector_for_cost *, int, extern unsigned record_stmt_cost (stmt_vector_for_cost *, int, enum vect_cost_for_stmt, enum vect_cost_model_location); +extern unsigned record_stmt_cost (stmt_vector_for_cost *, int, + enum vect_cost_for_stmt, stmt_vec_info, + slp_tree, tree, int, + enum vect_cost_model_location); /* Overload of record_stmt_cost with VECTYPE derived from STMT_INFO. */ @@ -2375,12 +2379,8 @@ record_stmt_cost (stmt_vector_for_cost *body_cost_vec, int count, slp_tree node, int misalign, enum vect_cost_model_location where) { - if (node) - return record_stmt_cost (body_cost_vec, count, kind, node, - STMT_VINFO_VECTYPE (stmt_info), misalign, where); - else - return record_stmt_cost (body_cost_vec, count, kind, stmt_info, - STMT_VINFO_VECTYPE (stmt_info), misalign, where); + return record_stmt_cost (body_cost_vec, count, kind, stmt_info, node, + STMT_VINFO_VECTYPE (stmt_info), misalign, where); } extern void vect_finish_replace_stmt (vec_info *, stmt_vec_info, gimple *); @@ -2411,12 +2411,12 @@ extern bool vect_nop_conversion_p (stmt_vec_info); extern opt_result vect_analyze_stmt (vec_info *, stmt_vec_info, bool *, slp_tree, slp_instance, stmt_vector_for_cost *); -extern void vect_get_load_cost (vec_info *, stmt_vec_info, int, +extern void vect_get_load_cost (vec_info *, stmt_vec_info, slp_tree, int, dr_alignment_support, int, bool, unsigned int *, unsigned int *, stmt_vector_for_cost *, stmt_vector_for_cost *, bool); -extern void vect_get_store_cost (vec_info *, stmt_vec_info, int, +extern void vect_get_store_cost (vec_info *, stmt_vec_info, slp_tree, int, dr_alignment_support, int, unsigned int *, stmt_vector_for_cost *); extern bool vect_supportable_shift (vec_info *, enum tree_code, tree); |