aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-11-21 17:45:36 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-11-21 17:45:36 +0000
commit557532d1728af193d47867dabbe26bd556fb8586 (patch)
tree61e5d148c084e4903914eb83f17fc6d938f64b2d /gcc
parent91f161b03b649984991573c2f2605555da4a678c (diff)
downloadgcc-557532d1728af193d47867dabbe26bd556fb8586.zip
gcc-557532d1728af193d47867dabbe26bd556fb8586.tar.gz
gcc-557532d1728af193d47867dabbe26bd556fb8586.tar.bz2
Reject versioning for alignment with different masks (PR 92526)
Allowing mixed vector sizes broke the assumption in the following assert, since it's now possible for different accesses to require different levels of alignment: /* FORNOW: use the same mask to test all potentially unaligned references in the loop. The vectorizer currently supports a single vector size, see the reference to GET_MODE_NUNITS (TYPE_MODE (vectype)) where the vectorization factor is computed. */ gcc_assert (!LOOP_VINFO_PTR_MASK (loop_vinfo) || LOOP_VINFO_PTR_MASK (loop_vinfo) == mask); I guess we could try to over-align smaller accesses so that all of them are consistent, or try to support multiple alignment masks, but for now the easiest fix seems to be to turn the assert into a bail-out check. 2019-11-21 Richard Sandiford <richard.sandiford@arm.com> gcc/ PR tree-optimization/92526 * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Reject versioning for alignment if the accesses do not have a consistent mask, rather than asserting that the masks are consistent. gcc/testsuite/ PR tree-optimization/92526 * gcc.target/aarch64/pr92526.c: New test. From-SVN: r278592
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr92526.c9
-rw-r--r--gcc/tree-vect-data-refs.c16
4 files changed, 30 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 859dd71..a4b4580 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2019-11-21 Richard Sandiford <richard.sandiford@arm.com>
+ PR tree-optimization/92526
+ * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Reject
+ versioning for alignment if the accesses do not have a consistent
+ mask, rather than asserting that the masks are consistent.
+
+2019-11-21 Richard Sandiford <richard.sandiford@arm.com>
+
PR tree-optimization/92595
* tree-vect-stmts.c (get_group_load_store_type): Add a VECTOR_MODE_P
check.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0250eeb..1f30ffd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2019-11-21 Richard Sandiford <richard.sandiford@arm.com>
+ PR tree-optimization/92526
+ * gcc.target/aarch64/pr92526.c: New test.
+
+2019-11-21 Richard Sandiford <richard.sandiford@arm.com>
+
PR testsuite/92543
* gcc.dg/vect/vect-alias-check-1.c: XFAIL the alias check message
if there is no realignment support and no support for unaligned
diff --git a/gcc/testsuite/gcc.target/aarch64/pr92526.c b/gcc/testsuite/gcc.target/aarch64/pr92526.c
new file mode 100644
index 0000000..61b347c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr92526.c
@@ -0,0 +1,9 @@
+/* { dg-options "-O3 -mstrict-align" } */
+
+void
+f (unsigned int *restrict x, unsigned int *restrict y,
+ unsigned char *restrict z, unsigned int n)
+{
+ for (unsigned int i = 0; i < n % 4; ++i)
+ x[i] = x[i] + y[i] + z[i];
+}
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 72a7094..b876d07 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -2266,13 +2266,15 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
mask must be 15 = 0xf. */
mask = size - 1;
- /* FORNOW: use the same mask to test all potentially unaligned
- references in the loop. The vectorizer currently supports
- a single vector size, see the reference to
- GET_MODE_NUNITS (TYPE_MODE (vectype)) where the
- vectorization factor is computed. */
- gcc_assert (!LOOP_VINFO_PTR_MASK (loop_vinfo)
- || LOOP_VINFO_PTR_MASK (loop_vinfo) == mask);
+ /* FORNOW: use the same mask to test all potentially unaligned
+ references in the loop. */
+ if (LOOP_VINFO_PTR_MASK (loop_vinfo)
+ && LOOP_VINFO_PTR_MASK (loop_vinfo) != mask)
+ {
+ do_versioning = false;
+ break;
+ }
+
LOOP_VINFO_PTR_MASK (loop_vinfo) = mask;
LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo).safe_push (stmt_info);
}