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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |7.5.0

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So this is bascially the missed optimization:
```
void foo(void);
int main()
{
  unsigned h = 123+5;
  for(unsigned g = 123; g != 0; g--)
  {
    h--;
    if(h == 0)
       foo();
  }
}
```
The relationship between h and g is `h = g + 5` so you can never get `h == 0`
in the loop as the range of g is [123,0].

Note In the original testcase, only GCC 8-11 dom3 (on x86_64; but not on
aarch64 due to IVOPTS differences) could optimize away the call to foo.

Also note LLVM can optimize it away both the above testcase and the original
one.

Reply via email to