https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70729
--- Comment #33 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
In any case, loop->safelen > 0 test looks also wrong, if there are guarantees
about single iteration only (safelen(1)), then there is nothing useful at all.
So it must be loop->safelen >= 2.

For foo in #c29, the q[0] load in foo can be hoisted before the loop.
More complicated is e.g.:
void baz (int *p, int *q, int *r, int *s)
{
  #pragma omp simd
  for (int i = 0; i < 1024; i++)
    {
      p[i] += q[0] * 6;
      r[i] += s[0] * 9;
    }
}
Here IMNSHO only q[0] * 6 can be hoisted before the loop, while it can alias
p[1023] (or for x < 1023 p[x] if p[x] is initially 0), p[1023] could validly
alias s[0] and thus s[0] * 9 must not be hoisted.

Reply via email to