[llvm-dev] valid BasicAA behavior?

Chawla, Pankaj via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 16 22:28:39 PDT 2020

Hi all,

I have this test case-

#define N 1000
extern double Ag[N];
extern double Bg[N];

void consume(double *A, double *B);

void swap_deps() {
  double *A = Ag;
  double *B = Bg;

  for (int i = 0; i < 97; ++i) {
    for (int j = 0; j < N; ++j) {
      B[j] = A[j] + 1;

    double *tmp = A;
    A = B;
    B = tmp;

  consume(A, B);

BasicAA is returning 'NoAlias' when queried for phis created in the i-loop for A and B.
I was expecting it to return MayAlias since A and B are being swapped in the outer loop and so they access same locations in alternate iterations of the i-loop.

Is BasicAA returning the correct result in this case?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200317/df434953/attachment.html>

More information about the llvm-dev mailing list