aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2024-10-15 11:22:26 +0100
committerTamar Christina <tamar.christina@arm.com>2024-10-15 11:22:26 +0100
commita1540bb843fd1a3e87f50d3f713386eaae454d1c (patch)
tree15b6054ad02a2895738cdd7faab1bf2fc2165abb /gcc/tree-vectorizer.h
parent1aac888fac6cff63a3d6522bcf9b8439e14320ad (diff)
downloadgcc-a1540bb843fd1a3e87f50d3f713386eaae454d1c.zip
gcc-a1540bb843fd1a3e87f50d3f713386eaae454d1c.tar.gz
gcc-a1540bb843fd1a3e87f50d3f713386eaae454d1c.tar.bz2
AArch64: re-enable memory access costing after SLP change.
While chasing down a costing difference between SLP and non-SLP for memory access costing I noticed that at some point the SLP and non-SLP costing have diverged. It used to be we only supported LOAD_LANES in SLP and so the non-SLP costing was working fine. But with the change to SLP only we now lost costing. It looks like the vectorizer for non-SLP stores the VMAT type in STMT_VINFO_MEMORY_ACCESS_TYPE on the stmt_info, but for SLP it stores it in SLP_TREE_MEMORY_ACCESS_TYPE which is on the SLP node itself. While my first attempt of a patch was to just also store the VMAT in the stmt_info https://gcc.gnu.org/pipermail/gcc-patches/2024-October/665295.html Richi pointed out that this goes wrong when the same access is used Hybrid. And so we have to do a backend specific fix. To help out other backends this also introduces a generic helper function suggested by Richi in that patch (I hope that's ok.. I didn't want to split out just the helper.) This successfully restores VMAT based costing in the new SLP only world. gcc/ChangeLog: * tree-vectorizer.h (vect_mem_access_type): New. * config/aarch64/aarch64.cc (aarch64_ld234_st234_vectors): Use it. (aarch64_detect_vector_stmt_subtype): Likewise. (aarch64_adjust_stmt_cost): Likewise. (aarch64_vector_costs::count_ops): Likewise. (aarch64_vector_costs::add_stmt_cost): Make SLP node named.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r--gcc/tree-vectorizer.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 11f921f..b7f2708 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -2730,6 +2730,18 @@ vect_is_reduction (stmt_vec_info stmt_info)
return STMT_VINFO_REDUC_IDX (stmt_info) >= 0;
}
+/* Returns the memory acccess type being used to vectorize the statement. If
+ SLP this is read from NODE, otherwise it's read from the STMT_VINFO. */
+
+inline vect_memory_access_type
+vect_mem_access_type (stmt_vec_info stmt_info, slp_tree node)
+{
+ if (node)
+ return SLP_TREE_MEMORY_ACCESS_TYPE (node);
+ else
+ return STMT_VINFO_MEMORY_ACCESS_TYPE (stmt_info);
+}
+
/* If STMT_INFO describes a reduction, return the vect_reduction_type
of the reduction it describes, otherwise return -1. */
inline int