https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109505
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org, | |rsandifo at gcc dot gnu.org --- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #8) > (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) We expect these to always fold :/ If they don't for POLY_INTs then maybe add a (if (!POLY_INT_CST_P (...) guard. There are many patterns that are affected by this.