https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120357
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> --- The following fixes this. I'm not 100% convinced but it does seem "obvious" (but for the "peeled" case we seem to eventually create duplicate COND reduction IVs? But possibly we reject this case anyhow). I'm testing this now. diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 4af510ff20c..cf5b9f3f979 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -6029,7 +6029,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, /* Create an induction variable. */ gimple_stmt_iterator incr_gsi; bool insert_after; - vect_iv_increment_position (loop_exit, &incr_gsi, &insert_after); + vect_iv_increment_position (LOOP_VINFO_IV_EXIT (loop_vinfo), + &incr_gsi, &insert_after); create_iv (series_vect, PLUS_EXPR, vec_step, NULL_TREE, loop, &incr_gsi, insert_after, &indx_before_incr, &indx_after_incr);