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

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the difference now is:

```
void f0(int n, float *v)
{
  int i;
  if (n <= 0)
    return;
  else
    {
      i = 1;
      do {
        if (i > n)  __builtin_abort ();
        v[i] = 0.0;
        i++;
      } while (i != n);
    }
}

void f1(int n, float *v)
{
  int i;
  if (n <= 0)
    return;
  else
    {
      i = 1;
      do {
        if (i > n)  __builtin_abort ();
        v[i] = 0.0;
        i++;
      } while (i <= n);
    }
}
```

Dom2 can remove the if for f1 while not for f0 due to the relationship in the
f0 is `!=` and `>` while in the second case it is `<=`/`>` for both.

Also the original fortran testcase still does not optimize either for LP64
targets. where fortran uses basically long to do the math
 something like:
```
float v[1000];
void f1(int n)
{
  int i;
  if (n <= 0)
    return;
  else
    {
      i = 1;
      do {
        long t = i;
        if (t > (long)n)  __builtin_abort ();
        v[i] = 0.0;
        t++;
        i = t;
      } while (i <= n);
    }
}

```

Reply via email to