https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111542

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note IOR with != 0 has the same issue.
Full testcase:
```
_Bool f_and(int x,int y)
{
  _Bool a = x == 0;
  _Bool b = y == 0;
  _Bool t = a & b;
  return t & !a;
}


_Bool f_or(int x,int y)
{
  _Bool a = x != 0;
  _Bool b = y != 0;
  _Bool t = a | b;
  return t | !a;
}
```

Match pattern:
```
(for bitop (bit_ior bit_and)
     cmp1  (eq      ne     )
     cmp2  (ne      eq     )
 (simplify
  (bitop:c
   (cmp1 @1 integer_zerop)
   (cmp2 (bit_ior:c @0 @1) integer_zerop))
  { constant_boolean_node (bitop == BIT_IOR_EXPR, type); }))
```

Reply via email to