https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99880
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we're having a PHI latch value vectorized because it's used by the outer
loop (vect_used_in_outer_by_reduction), but the vect_nested_cycle def PHI
in the inner loop isn't relevant since it's vect_unused_in_scope:
<bb 5> [local count: 11811160]:
# g_36 = PHI <g_21(11), -8(15)>
# c_lsm.16_20 = PHI <_12(11), c_lsm.16_29(15)>
# ivtmp_18 = PHI <ivtmp_1(11), 1717986920(15)>
g_21 = g_36 + 5;
vect_cst__28 = { 0, 0, 0, 0 };
<bb 6> [local count: 118111600]:
# h_14 = PHI <10(5), h_24(12)>
# c_lsm.16_22 = PHI <c_lsm.16_20(5), _10(12)>
# ivtmp_30 = PHI <10(5), ivtmp_31(12)>
h_24 = h_14 + -1;
_7 = d.6_6 <= c_lsm.16_22;
_8 = (int) _7;
vect__10.19_33 = vect_cst__28;
_10 = 0;
ivtmp_31 = ivtmp_30 - 1;
if (ivtmp_31 != 0)
goto <bb 12>; [90.00%]
else
goto <bb 9>; [10.00%]
<bb 12> [local count: 106300440]:
goto <bb 6>; [100.00%]
<bb 9> [local count: 11811160]:
# _27 = PHI <_10(6)>
_12 = _27 - e.10_11;
it's the c_lsm.16_22 PHI and the _10 backedge def (note how we failed to
constant propagate the 10 ...). The fix is simple and hopefully it doesn't
break other stuff.