From f53e9d40de7212413b361758d66aafb833173dd9 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 3 Nov 2020 09:53:11 +0100 Subject: 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 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. --- gcc/tree-vect-slp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/tree-vect-slp.c') 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; } -- cgit v1.1