https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69882
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- The IL you refer to makes sense to me, the vectorizer sees t.f90:13:0: note: Final SLP tree for instance: t.f90:13:0: note: node t.f90:13:0: note: stmt 0 M.0_140 = MAX_EXPR <_139, c_I_lsm.10_129>; t.f90:13:0: note: stmt 1 M.0_143 = MAX_EXPR <_142, c_I_lsm.11_130>; t.f90:13:0: note: node t.f90:13:0: note: stmt 0 _139 = *a_22(D)[_138]; t.f90:13:0: note: stmt 1 _142 = *a_22(D)[_141]; t.f90:13:0: note: === vect_make_slp_decision === t.f90:13:0: note: Decided to SLP 1 instances. Unrolling factor 2 and thus it is a SLP reduction of two scalars. Not sure how it became that, the simple testcase became a whack-a-mole due to earlier opts. <bb 17>: # k_127 = PHI <k.4_11(16), k_154(19)> # c_I_lsm.10_129 = PHI <c_I_lsm.10_48(16), M.0_140(19)> # c_I_lsm.11_130 = PHI <c_I_lsm.11_3(16), M.0_143(19)> _136 = (integer(kind=8)) k_127; _137 = _136 * 4; _138 = _137 + -4; _139 = *a_22(D)[_138]; M.0_140 = MAX_EXPR <c_I_lsm.10_129, _139>; _141 = _137 + -3; _142 = *a_22(D)[_141]; M.0_143 = MAX_EXPR <c_I_lsm.11_130, _142>; k_154 = k_127 + 1; if (k_127 == 26) goto <bb 18>; else goto <bb 19>; <bb 18>: # c_I_lsm.13_234 = PHI <c_I_lsm.13_84(17)> # c_I_lsm.12_219 = PHI <c_I_lsm.12_13(17)> # M.0_218 = PHI <M.0_143(17)> # M.0_217 = PHI <M.0_140(17)> goto <bb 42>; so we produce vectorized reductions for _218 and _217. loop unswitching produces all those cases. Simplifying the testcase to a constant 'y' makes it still fail but very much easier to analyze.