https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68413
--- Comment #7 from Ilya Enkovich <ienkovich at gcc dot gnu.org> --- Looking deeper the difference is caused by different result of is_nonwrapping_integer_induction called for reduction related phi statement. For the first call it is: i_12 = PHI <i_7(4), 0(2)> For the second call it is: i_12 = PHI <i_7(4), i_23(22)> It changed due to generated prologue. It cases is_nonwrapping_integer_induction to return false due to non-constant base and as a result we compute different reduction type. Probably compute reduction type at analysis phase only?