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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|`a - b == b - a` -> `a ==   |A few missing optimizations
                   |b`                          |due to `a - b` and `b - a`
                   |                            |not being detected as
                   |                            |negatives of each other

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Another one:
```
int f(int a, int b, int x)
{
  x = a - b;
  int y = -x;
  return (x >= 0 ? x : 0) + (x <= 0 ? y : 0);
}
```

This should be detected as `abs<a - b>` (just like if the assignment to x is
removed.

Reply via email to