aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-01-21 14:58:43 +0100
committerRichard Biener <rguenth@gcc.gnu.org>2025-01-23 08:43:39 +0100
commit7fffff1deb47a70ff804f0b2cce7be7e5fe8ba13 (patch)
tree27d8d5cf5ad0573360b8b6bd5085010872534649 /gcc/tree-vectorizer.h
parent2119c254606c58d247d3d0b92bf192780d375ddb (diff)
downloadgcc-7fffff1deb47a70ff804f0b2cce7be7e5fe8ba13.zip
gcc-7fffff1deb47a70ff804f0b2cce7be7e5fe8ba13.tar.gz
gcc-7fffff1deb47a70ff804f0b2cce7be7e5fe8ba13.tar.bz2
tree-optimization/118558 - fix alignment compute with VMAT_CONTIGUOUS_REVERSE
There are calls to dr_misalignment left that do not correct for the offset (which is vector type dependent) when the stride is negative. Notably vect_known_alignment_in_bytes doesn't allow to pass through such offset which the following adds (computing the offset in vect_known_alignment_in_bytes would be possible as well, but the offset can be shared as seen). Eventually this function could go away. This leads to peeling for gaps not considerd, nor shortening of the access applied which is what fixes the testcase on x86_64. PR tree-optimization/118558 * tree-vectorizer.h (vect_known_alignment_in_bytes): Pass through offset to dr_misalignment. * tree-vect-stmts.cc (get_group_load_store_type): Compute offset applied for negative stride and use it when querying alignment of accesses. (vectorizable_load): Likewise. * gcc.dg/vect/pr118558.c: New testcase.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r--gcc/tree-vectorizer.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 79db02a..44d3a1d 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -2028,9 +2028,10 @@ known_alignment_for_access_p (dr_vec_info *dr_info, tree vectype)
of DR_INFO is guaranteed to have. */
inline unsigned int
-vect_known_alignment_in_bytes (dr_vec_info *dr_info, tree vectype)
+vect_known_alignment_in_bytes (dr_vec_info *dr_info, tree vectype,
+ poly_int64 offset = 0)
{
- int misalignment = dr_misalignment (dr_info, vectype);
+ int misalignment = dr_misalignment (dr_info, vectype, offset);
if (misalignment == DR_MISALIGNMENT_UNKNOWN)
return TYPE_ALIGN_UNIT (TREE_TYPE (DR_REF (dr_info->dr)));
else if (misalignment == 0)