https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123983
--- Comment #8 from Tamar Christina <tnfchris at gcc dot gnu.org> --- (In reply to Richard Biener from comment #7) > This is caused by r16-5780-g65a3849eb46df2 which does this semantic change > in the following hunk and reverting this fixes the issue - the IV is then > correctly only updated on the edge to the epilog, not on the use for the > live operation. > > I'm testing reversal of that hunk. > > @@ -2419,8 +2434,15 @@ vect_update_ivs_after_vectorizer (loop_vec_info > loop_vinf > o, > gsi_insert_seq_before (&last_gsi, new_stmts, GSI_SAME_STMT); > } > > - /* Fix phi expressions in the successor bb. */ > - adjust_phi_and_debug_stmts (phi1, update_e, ni_name); > + /* Fix phi expressions in all out of loop bb. */ > + imm_use_iterator imm_iter; > + gimple *use_stmt; > + use_operand_p use_p; > + tree ic_var = PHI_ARG_DEF_FROM_EDGE (phi1, update_e); > + FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, ic_var) > + if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) > + FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) > + SET_USE (use_p, ni_name); > } > } That doesn't sound quite right to me and is probably going to fail. The reason for the change was because when we add a skip_epilog to the merge block we can introduce a block which goes to an exit which has copied the live values from the loop it was copied from. This value is out of date, as if we skip the epilogue it can't use a value derived from the epilog. So the loop was added to update those out of loop uses.
