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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think the simple missed optimization here is:
```
int f2(int a)
{
 if(a != -1 && a != 0)
   __builtin_unreachable();
  unsigned c = a;
  if(c > 121212)
    return 1;
  return 0;
}
```
This should be optimized to just:
```
int f2_(int a)
{
  return a != 0;
}
```


That is if we have:
```
  # RANGE [irange] unsigned int [0, 0][+INF, +INF]
  a.0_1 = (unsigned int) a_4(D);
  if (a.0_1 > 121212)
```
Since we have two values for a.0_1 we can just compare to one or the other in
the above case.

Then that will optimize the original testcase as we can optimize away the
nop_convert and then negative and then we get:
t1 <= t1
and that is folded trivially to true.

Reply via email to