aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-11-10 13:36:22 +0100
committerRichard Biener <rguenther@suse.de>2020-11-10 13:37:49 +0100
commit1693746302e4306b43cb66a0afe589137069bd8e (patch)
tree44048382cc30ae4249deb51881a1948b737f6439 /gcc
parent960c4712c8e1e08f29af999d4198bd96fcccb93c (diff)
downloadgcc-1693746302e4306b43cb66a0afe589137069bd8e.zip
gcc-1693746302e4306b43cb66a0afe589137069bd8e.tar.gz
gcc-1693746302e4306b43cb66a0afe589137069bd8e.tar.bz2
tree-optimization/97769 - fix assert in peeling for alignment
The following removes an assert that can not easily be adjusted to cover the additional cases we now handle after the removal of the same-align DRs vector. 2020-11-10 Richard Biener <rguenther@suse.de> PR tree-optimization/97769 * tree-vect-data-refs.c (vect_update_misalignment_for_peel): Remove assert. * gcc.dg/vect/pr97769.c: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97769.c32
-rw-r--r--gcc/tree-vect-data-refs.c7
2 files changed, 33 insertions, 6 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/pr97769.c b/gcc/testsuite/gcc.dg/vect/pr97769.c
new file mode 100644
index 0000000..127f91a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97769.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+typedef struct {
+ int alg;
+ int h1[8];
+ unsigned d1[1];
+} tmp;
+typedef struct {
+ tmp itmp;
+ tmp otmp;
+} h1;
+h1 c;
+
+static void
+fn1(char *p1, int p2)
+{
+ int i = 0;
+ for (; i < 4; i++)
+ *p1++ = p2;
+}
+
+static void
+fn2(tmp *p1)
+{
+ char *d = (char *)p1->d1;
+ int *b = p1->h1;
+ for (int a; a; a++, d += 4)
+ fn1(d, *b++);
+}
+
+void fn3() { fn2(&(&c)->otmp); }
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 8afd304..0efab49 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -1186,14 +1186,9 @@ static void
vect_update_misalignment_for_peel (dr_vec_info *dr_info,
dr_vec_info *dr_peel_info, int npeel)
{
- /* It can be assumed that if dr_info has the same alignment as dr_peel,
- it is aligned in the vector loop. */
+ /* If dr_info is aligned of dr_peel_info is, then mark it so. */
if (vect_dr_aligned_if_peeled_dr_is (dr_info, dr_peel_info))
{
- gcc_assert (!known_alignment_for_access_p (dr_info)
- || !known_alignment_for_access_p (dr_peel_info)
- || (DR_MISALIGNMENT (dr_info)
- == DR_MISALIGNMENT (dr_peel_info)));
SET_DR_MISALIGNMENT (dr_info, 0);
return;
}