https://gcc.gnu.org/g:e887376de60a6ae60b81156064cb413db8c90353
commit r17-5092-ge887376de60a6ae60b81156064cb413db8c90353 Author: Alfie Richards <[email protected]> Date: Mon Oct 12 13:24:21 2026 +0000 fix: Use LOOP_VINFO_MAIN_EXIT for final iv edge [PR 127805] 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. Diff: --- 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 62bd213692f2..5e875d88f831 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); } }
