https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101505
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- vectorizable_lc_phi get's the vectorized stmts of _4 = xb_17 <= 0; but sees the mask rather than the pattern stmt used to produce the desired result. The def_stmt is vect_used_in_outer, and otherwise the use stmt is "dead". We also failed to mark the pattern. That said, the failure looks like it is in bool pattern recog which fails to see the use of _4 = xb_17 <= 0 in non-bool context here. <bb 4> [local count: 715863673]: # xb_17 = PHI <xb_5(8), xb_2(3)> # qp_19 = PHI <qp_7(8), 0(3)> # ivtmp_15 = PHI <ivtmp_6(8), 2(3)> _4 = xb_17 <= 0; xb_5 = (short int) _4; qp_7 = qp_19 + 1; ivtmp_6 = ivtmp_15 - 1; if (ivtmp_6 != 0) goto <bb 8>; [66.67%] else goto <bb 5>; [33.33%] <bb 5> [local count: 357878152]: # _18 = PHI <_4(4)> _8 = (char) _18; retval.2[iter.3_10] = _8; iter.3_11 = iter.3_10 + 1; ivtmp_16 = ivtmp_3 - 1; if (ivtmp_16 != 0) goto <bb 7>; [100.00%] else goto <bb 6>; [0.00%] I've fixed this once for BB vect but not loop vect (I guess due to lack of a testcase).