https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64493
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- I tried to make a runtime testcase that tests for proper vectorization but all vectorized code ends up being dead. Nevertheless the following fixes the ICE: Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c (revision 219520) +++ gcc/tree-vect-loop.c (working copy) @@ -4580,7 +4580,10 @@ vect_finalize_reduction: && !STMT_VINFO_LIVE_P (exit_phi_vinfo)) || double_reduc); - STMT_VINFO_VEC_STMT (exit_phi_vinfo) = epilog_stmt; + if (double_reduc) + STMT_VINFO_VEC_STMT (exit_phi_vinfo) = inner_phi; + else + STMT_VINFO_VEC_STMT (exit_phi_vinfo) = epilog_stmt; if (!double_reduc || STMT_VINFO_DEF_TYPE (exit_phi_vinfo) != vect_double_reduction_def) and the generated code looks reasonable. I think we don't really support the case where the inner reduction result is used in the outer loop (but in !relevant stmts which end up dead). Well. Not 100% sure.