https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113373
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- All good after vect_do_peeling. It's wrecked by vect_create_epilog_for_reduction here: scalar_result = scalar_results[k]; FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, orig_name) { FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) SET_USE (use_p, scalar_result); update_stmt (use_stmt); we have two reduction epilogues, one for the early and one for the late exit but we mismatch the scalar use to replace. We're also picking up a reduction that's only live on one edge on the other (but that doesn't seem to result in a problem here). It also seems we're doing epilogue code generation before creating some exit PHIs required for that - vect_do_peeling fails to do that. We can try to hack around that a bit, but there's more issues with this testcase, like we generate useless epilogues - it seems we should identify the scalar exit PHI to transform when calling epilogue generation for a specific edge and skip if there isn't one.