This fixes the vectorizer loop versioning code failing to clear niter related info on the scalar loop as it assumed get_loop_copy would work even for the outermost loop. The patch makes that assumption hold by adjusting the loop versioning code.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-07-05 Richard Biener <rguent...@suse.de> PR middle-end/101291 * cfgloopmanip.c (loop_version): Set the loop copy of the versioned loop to the new loop. --- gcc/cfgloopmanip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index e6df28036c4..2af59fedc92 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1731,6 +1731,7 @@ loop_version (class loop *loop, then_scale, else_scale); copy_loop_info (loop, nloop); + set_loop_copy (loop, nloop); /* loopify redirected latch_edge. Update its PENDING_STMTS. */ lv_flush_pending_stmts (latch_edge); -- 2.26.2