https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109505
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #7) > Fails even in GCC 11.1.0. > It is due to match.pd's > > /* (x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2) */ > (simplify > (bit_and (bit_ior @0 CONSTANT_CLASS_P@1) CONSTANT_CLASS_P@2) > (bit_ior (bit_and @0 @2) (bit_and @1 @2))) > > POLY_INT_CST is a CONSTANT_CLASS but does not simplify on the bit_and. > So maybe it should include a ! on the (bit_and @1 @2) . Which then will go into a loop with: (A | B) & (A | C) into A | (B & C)