diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-11-29 14:48:30 +0000 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2019-11-29 14:48:30 +0000 |
commit | 47d7cc3971e60db7de525934237fb85b1f2e1a56 (patch) | |
tree | 4e208d19de064a1a6dab5a34778f71384ef8d667 | |
parent | 4528616f0116cf0b36c3a801f8923358f01cd40e (diff) |
Fix DR_GROUP_GAP for strided accesses (PR 92677)
When dissolving an SLP-only group of accesses, we should only set
the gap to group_size - 1 for normal non-strided groups.
2019-11-29 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR tree-optimization/92677
* tree-vect-loop.c (vect_dissolve_slp_only_groups): Set the gap
to zero when dissolving a group of strided accesses.
gcc/testsuite/
PR tree-optimization/92677
* gcc.dg/vect/pr92677.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@278852 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr92677.c | 26 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 5 |
4 files changed, 41 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 002d9aa1217..ea1a587f80b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2019-11-29 Richard Sandiford <richard.sandiford@arm.com> + PR tree-optimization/92677 + * tree-vect-loop.c (vect_dissolve_slp_only_groups): Set the gap + to zero when dissolving a group of strided accesses. + +2019-11-29 Richard Sandiford <richard.sandiford@arm.com> + PR tree-optimization/92596 * tree-vect-stmts.c (vectorizable_call): Punt on hybrid mask/nonmask operations. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 57544a5c17a..375202bc493 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2019-11-29 Richard Sandiford <richard.sandiford@arm.com> + PR tree-optimization/92677 + * gcc.dg/vect/pr92677.c: New test. + +2019-11-29 Richard Sandiford <richard.sandiford@arm.com> + PR tree-optimization/92596 * gcc.dg/vect/bb-slp-pr92596.c: New test. * gcc.dg/vect/bb-slp-43.c: Likewise. diff --git a/gcc/testsuite/gcc.dg/vect/pr92677.c b/gcc/testsuite/gcc.dg/vect/pr92677.c new file mode 100644 index 00000000000..3f85b295249 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr92677.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3" } */ + +int a, c; +int *b; +long d; +double *e; + +void fn1() { + long f; + double g, h; + while (c) { + if (d) { + g = *e; + *(b + 4) = g; + } + if (f) { + h = *(e + 2); + *(b + 6) = h; + } + e += a; + b += 8; + c--; + d += 2; + } +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index ab48a05dbed..77c5a9816e2 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1829,7 +1829,10 @@ vect_dissolve_slp_only_groups (loop_vec_info loop_vinfo) DR_GROUP_FIRST_ELEMENT (vinfo) = vinfo; DR_GROUP_NEXT_ELEMENT (vinfo) = NULL; DR_GROUP_SIZE (vinfo) = 1; - DR_GROUP_GAP (vinfo) = group_size - 1; + if (STMT_VINFO_STRIDED_P (first_element)) + DR_GROUP_GAP (vinfo) = 0; + else + DR_GROUP_GAP (vinfo) = group_size - 1; vinfo = next; } } |