[llvm-dev] AliasAnalysis: may-alias subcategory

Nuno Lopes via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 7 05:42:12 PDT 2017


You're right that stating may-alias(A, B) and may-alias(A, C) are the only 
possible answers right now, since the compiler cannot possibly know if these 
alias or not.
LLVM supports the noalias attribute for function parameters, which may be 
what you're looking for?  http://llvm.org/docs/LangRef.html#noalias

If not, how differentiating between a may-alias and a 
may-alias-because-it's-input would help?  Do you have a particular 
optimization that would be enabled?

Nuno

-----Original Message-----
From: Nema, Ashutosh via llvm-dev
Sent: Monday, August 7, 2017 12:29 PM
Subject: [llvm-dev] AliasAnalysis: may-alias subcategory

Hi,

The current AliasAnalysis marks may-alias for cases when memory passed as 
function argument.

i.e.
void foo(int *A, int *B, int *C) {
  for (int i=0; i<N; i++)
       A[i] = B[i] + C[i];
}

In the above example, it’s may-alias for memory ‘A’, because ’A’ is not 
known at ‘foo’ call sites.
Alias analysis is able to figure out memory ‘A’ is no-alias, if I modify the 
above test by making ‘A’ as an stack variable.

I’m interested to find the cases where memory is always may-alias because of 
input function parameter.
Probably a sub category(may-alias-because-of-function-parameter) of 
may-alias may help.

Not sure llvm already has something to sub categorize may-alias cases.

Thanks,
Ashutosh 



More information about the llvm-dev mailing list