aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2020-12-31 16:51:33 +0000
committerRichard Sandiford <richard.sandiford@arm.com>2020-12-31 16:51:33 +0000
commit9fa5b473b5b8e289b6542adfd5cfaddfb3036048 (patch)
tree9de2507dc2fad33cd02214bcdd24b6deac975760 /gcc/tree-vect-data-refs.c
parent0411210fddbd3ec27c8dc1183f40f662712a2232 (diff)
downloadgcc-9fa5b473b5b8e289b6542adfd5cfaddfb3036048.zip
gcc-9fa5b473b5b8e289b6542adfd5cfaddfb3036048.tar.gz
gcc-9fa5b473b5b8e289b6542adfd5cfaddfb3036048.tar.bz2
vect: Fix bogus alignment assumption in alias checks [PR94994]
This PR is about a case in which the vectoriser was feeding incorrect alignment information to tree-data-ref.c, leading to incorrect runtime alias checks. The alignment was taken from the TREE_TYPE of the DR_REF, which in this case was a COMPONENT_REF with a normally-aligned type. However, the underlying MEM_REF was only byte-aligned. This patch uses dr_alignment to calculate the (byte) alignment instead, just like we do when creating vector MEM_REFs. gcc/ PR tree-optimization/94994 * tree-vect-data-refs.c (vect_vfa_align): Use dr_alignment. gcc/testsuite/ PR tree-optimization/94994 * gcc.dg/vect/pr94994.c: New test.
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r--gcc/tree-vect-data-refs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 1370170..5fe9cad 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -3258,7 +3258,7 @@ vect_vfa_access_size (vec_info *vinfo, dr_vec_info *dr_info)
static unsigned int
vect_vfa_align (dr_vec_info *dr_info)
{
- return TYPE_ALIGN_UNIT (TREE_TYPE (DR_REF (dr_info->dr)));
+ return dr_alignment (dr_info->dr);
}
/* Function vect_no_alias_p.