https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88280
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Match pattern: ``` (for cmp (eq ne ) bop (bit_ior bit_and) (bop:c (cmp @0 integer_zerop) (cmp@2 (bit_and:c @0 @1) integer_zerop)) @2) ``` testcase that shows the issue (of the swapped order of the ifs) ``` _Bool f0(int a, int b) { if (a == 0) return 1; return (a & b) == 0; // (a==0) | ((a &b) == 0) -> ((a &b) == 0) } _Bool f0_(int a, int b) { if ((a & b) == 0) return 1; return a == 0; // ((a &b) == 0) | (a==0) -> ((a &b) == 0) } _Bool f1(int a, int b) { if (a != 0) return (a & b) != 0; return 0; // (a!=0) & ((a & b) != 0) -> ((a & b) != 0) } _Bool f1_(int a, int b) { if ((a & b) != 0) return a != 0; return 0; // ((a & b) != 0) & (a!=0) -> ((a & b) != 0) } ```