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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the missed optimizations that VRP/PHIopt/match expose are:
```
unsigned f(void);
int i1(void)
{
  int l = 2;
  l = 3 - (int)f();
  return l <= 2; // f() > 0
}
int i2(void)
{
  unsigned l = 2;
  l = 3 - (unsigned)f();
  return l <= 2; // f() - 1 < 3
}

int i3(void)
{
  unsigned l = 2;
  l = 3 + (unsigned)f();
  return l <= 2; // f() > -4u
}

int i4(void)
{
  int l = 2;
  l = 3 + (int)f();
  return l <= 2; // f() < 0
}

```

This can be done even without knowing the range of `f()` here. and these is
done by clang already. Note GCC does handle i4 is already.

Reply via email to