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

            Bug ID: 111543
           Summary: `(a & b) & ~a` could be optimized before reassociation
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
_Bool fb(int x,int y)
{
  _Bool a = x == 1;
  _Bool b = y == 2;
  _Bool t = a & b;
  return t & !a;
}
int fi(int a,int b)
{
  int t = a & b;
  return t & ~a;
}

```
We should optimize both of these to `return 0` in ccp1.

Reply via email to