aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-11-03 09:53:11 +0100
committerRichard Biener <rguenther@suse.de>2020-11-03 09:56:40 +0100
commitf53e9d40de7212413b361758d66aafb833173dd9 (patch)
tree344ff015118255a0f995d91c1b975dba80207786 /gcc/tree-vect-slp.c
parent0caf400a865cb771f76bf1025cfc2a83e8ef00ed (diff)
downloadgcc-f53e9d40de7212413b361758d66aafb833173dd9.zip
gcc-f53e9d40de7212413b361758d66aafb833173dd9.tar.gz
gcc-f53e9d40de7212413b361758d66aafb833173dd9.tar.bz2
tree-optimization/97678 - fix SLP induction epilogue vectorization
This restores not tracking SLP nodes for induction initial values in not nested context because this interferes with peeling and epilogue vectorization. 2020-11-03 Richard Biener <rguenther@suse.de> PR tree-optimization/97678 * tree-vect-slp.c (vect_build_slp_tree_2): Do not track the initial values of inductions when not nested. * tree-vect-loop.c (vectorizable_induction): Look at PHI node initial values again for SLP and not nested inductions. Handle LOOP_VINFO_MASK_SKIP_NITERS and cost invariants. * gcc.dg/vect/pr97678.c: New testcase.
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 63a59c0..e97fbe8 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1444,9 +1444,13 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
if (def_type == vect_induction_def)
{
/* Induction PHIs are not cycles but walk the initial
- value. */
+ value. Only for inner loops through, for outer loops
+ we need to pick up the value from the actual PHIs
+ to more easily support peeling and epilogue vectorization. */
class loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- if (nested_in_vect_loop_p (loop, stmt_info))
+ if (!nested_in_vect_loop_p (loop, stmt_info))
+ skip_args[loop_preheader_edge (loop)->dest_idx] = true;
+ else
loop = loop->inner;
skip_args[loop_latch_edge (loop)->dest_idx] = true;
}