https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113364
--- Comment #9 from Tamar Christina <tnfchris at gcc dot gnu.org> --- vect_create_epilog_for_reduction needs to handle the case where the vectorizer has picked a different exit than the main one. diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index eccf0953bba..6f761a4a78f 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -5965,7 +5965,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, loop-closed PHI of the inner loop which we remember as def for the reduction PHI generation. */ bool double_reduc = false; - bool main_exit_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit; + bool main_exit_p = LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit + && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo); stmt_vec_info rdef_info = stmt_info; if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def) { fixes it. But would be good if I can reproduce the bootstrap issue. Will try with provided options.