The testcase from PR87561 shows a case where we have two in-memory reductions that are possibly dependent but the runtime alias check isn't needed since we only possibly re-order the summations in the reduction. Small C testcase: void foo (double *x, double *y, double * __restrict a, double * __restrict b) { for (int i = 0; i < 1024; ++i) { x[i] += a[i]; y[i] += b[i]; } } here x[] and y[] are dependent but we can vectorize this just fine with -fassociative-math, eliding the runtime alias check.
What if x = y + 1 or y = x + 1 ?
(In reply to Jakub Jelinek from comment #1) > What if x = y + 1 or y = x + 1 ? We then do (y+1)[i] += a[i]; (y+1)[i+1] += a[i+1]; y[i] += a[i]; y[i+1] += a[i+1]; instead of (y+1)[i] += a[i]; y[i] += a[i]; (y+1)[i+1] += a[i+1]; y[i+1] += a[i+1]; which should be OK if re-associating the adds to y[i+1] is OK.