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

            Bug ID: 112628
           Summary: `~a < -a` can be optimized to `a != 0` for unsigned
                    types
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
unsigned fu(unsigned a)
{
  return (~a) < -a;
}
```

This can be optimized to just `a != 0` like it is on the RTL level due to
optizing to ADD_OVERFLOW which started in GCC 11.

Reply via email to