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

            Bug ID: 106164
           Summary: (a > b) & (a >= b) does not get optimized until
                    reassoc1
           Product: gcc
           Version: 12.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
            Blocks: 105903
  Target Milestone: ---

Take:
```
_Bool f(int a, int b)
{
  _Bool c = a > b;
  _Bool d = a >= b;
  return c & d;
}
```
This does not get optimized until reassoc1.
While:
```
_Bool f(int a, int b)
{
  return (a > b) & (a >= b);
}
```
Gets optimized during folding (not by match though), I have not looked into
what does it though.

I noticed this while working on PR 105903 as there is not a reassoc pass after
phiopt4 so nothing optimizes.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105903
[Bug 105903] Missed optimization for __synth3way

Reply via email to