Use LOOP_VINFO_MAIN_EXIT instead of exit_edge when updating the final
IV for peeled control.

        PR tree-optimization/127805

gcc/ChangeLog:

        * tree-vect-loop-manip.cc
        (vect_set_loop_condition_partial_vectors_avx512): Use
        LOOP_VINFO_MAIN_EXIT instead of exit_edge for final_iv.
        (vect_set_loop_condition_normal): Likewise.

-- >8 --

Appologies, missed this with my last change.

Bootstrapped and regression tested on aarch64-linux-gnu, armhf-linux-gnu,
x86_64-linux-gnu.

Pushed as obvious,

KR,
Alfie

---
 gcc/tree-vect-loop-manip.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index 62bd213692f..5e875d88f83 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -1375,7 +1375,7 @@ vect_set_loop_condition_partial_vectors_avx512 (class 
loop *loop,
        }
        else
        assign = gimple_build_assign (final_iv, orig_niters);
-      gsi_insert_on_edge_immediate (exit_edge, assign);
+       gsi_insert_on_edge_immediate (LOOP_VINFO_MAIN_EXIT (loop_vinfo), 
assign);
     }
 
   return cond_stmt;
@@ -1529,7 +1529,8 @@ vect_set_loop_condition_normal (loop_vec_info loop_vinfo, 
edge exit_edge,
            }
          else
            assign = gimple_build_assign (final_iv, MINUS_EXPR, phi_dest, init);
-         gimple_stmt_iterator gsi = gsi_after_labels (exit_edge->dest);
+         gimple_stmt_iterator gsi
+           = gsi_after_labels (LOOP_VINFO_MAIN_EXIT (loop_vinfo)->dest);
          gsi_insert_before (&gsi, assign, GSI_SAME_STMT);
        }
     }

base-commit: 6b41a6a73ef8f39ac913c0224a2c23b67f2a0665
-- 
2.55.0

Reply via email to