middle-end/101291 - set loop copy of versioned loop
authorRichard Biener <rguenther@suse.de>
Mon, 5 Jul 2021 09:53:07 +0000 (11:53 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 5 Jul 2021 10:51:52 +0000 (12:51 +0200)
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.

2021-07-05  Richard Biener  <rguenther@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

index e6df280..2af59fe 100644 (file)
@@ -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);