https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109959
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #5) > This is basically PR 102138 . Except it works at -O1 because the cast is pushed out of the phi by phiopt but the cast is the same as a & 1 here :(. For comment #0 we could just match this for unsigned type a_2(D) > 1 ? 0 : a_2(D) == a_2(D) <= 1 ? a_2(D) : 0 -> (unsigned)(a == 1) For comment #3 we need to pattern match this now: _7 = (_Bool) a_6(D); _9 = a_6(D) <= 1; _10 = _7 & _9;