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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-05-26
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
if-conversion doesn't happen because the vectorizer wouldn't be happy with
the loop anyway because its latch block is not empty.  i is incremented
after the exit test.

If you write the testcase as

int main()
{
  unsigned int i = 0;
  unsigned int count = 0;

  while (1)
    {
      float n;
      __builtin_memcpy(&n, &i, sizeof(float));
      if(n >= 0.0f && n <= 1.0f)
        count++;
      i++;
      if (i == 0)
        break;
    }

  return count;
}

then it would work if the vectorizer weren't to check the 'wrong' number
of iterations to bail out for zero.

Basically, it's hard to write a loop that iterates UINT_MAX times with
an uint induction variable ;)

And yeah, I fixed a bug similar to LLVMs for 4.9 recently ... (PR59058).
It left the above missed-optimization hole.

Reply via email to