diff options
author | Richard Biener <rguenther@suse.de> | 2020-11-09 14:03:14 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-11-09 14:57:10 +0100 |
commit | f5761c318a5a973ba2e4e5b09a5213f4e3ad0570 (patch) | |
tree | d0bc0633720e95d0dbb215c10418720699f404a8 /gcc | |
parent | ec735bc7646500570d9d6e45ef335e6d547b1433 (diff) | |
download | gcc-f5761c318a5a973ba2e4e5b09a5213f4e3ad0570.zip gcc-f5761c318a5a973ba2e4e5b09a5213f4e3ad0570.tar.gz gcc-f5761c318a5a973ba2e4e5b09a5213f4e3ad0570.tar.bz2 |
tree-optimization/97753 - fix SLP induction vect
This fixes updating of the step vectors when filling up to group_size.
2020-11-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/97753
* tree-vect-loop.c (vectorizable_induction): Fill vec_steps
when CSEing inside the group.
* gcc.dg/vect/pr97753.c: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr97753.c | 10 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 7 |
2 files changed, 15 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/pr97753.c b/gcc/testsuite/gcc.dg/vect/pr97753.c new file mode 100644 index 0000000..e49a848 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr97753.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3" } */ + +long a[6]; +void d(int c) +{ + for (; c; c++) + for (int b = 0; b < 8; b++) + ((char *)&a[c])[b] = c; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 0ba3754..977633a 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -8068,8 +8068,11 @@ vectorizable_induction (loop_vec_info loop_vinfo, nivs = least_common_multiple (group_size, const_nunits) / const_nunits; for (; ivn < nivs; ++ivn) - SLP_TREE_VEC_STMTS (slp_node) - .quick_push (SLP_TREE_VEC_STMTS (slp_node)[0]); + { + SLP_TREE_VEC_STMTS (slp_node) + .quick_push (SLP_TREE_VEC_STMTS (slp_node)[0]); + vec_steps.safe_push (vec_steps[0]); + } } /* Re-use IVs when we can. We are generating further vector |