[LLVMdev] Alias Analysis across functions

Hal Finkel hfinkel at anl.gov
Mon Sep 29 05:51:58 PDT 2014


Hi Vinay,

The new -cfl-aa has an IPA that might catch this. Also, I'm working on a new pass to do top-down function parameter attribute propagation, which should catch this (http://reviews.llvm.org/D4609), but it is not quite ready yet.

 -Hal

----- Original Message -----
> From: "Vinay Madhusudan" <Vinay.Madhusudan at amd.com>
> To: "LLVM Developers Mailing List (llvmdev at cs.uiuc.edu)" <llvmdev at cs.uiuc.edu>
> Sent: Monday, September 29, 2014 12:55:18 AM
> Subject: [LLVMdev] Alias Analysis across functions
> 
> 
> 
> Hi,
> 
> I am trying to get the alias info for the following code. The alias
> analysis returns “MayAlias” for arrays “A” and “B” in both the
> functions instead of “NoAlias”. What passes should I run in opt
> before the alias analysis pass to get the accurate result?
> 
> Example:
> 
> //Note: static and called by func() only.
> static int sum(int *A, int *B) {
> 
> int i = 0, sum1 = 0;
> 
> for (i = 0; i < 100; ++i) {
> sum1 += A[i] + B[i];
> }
> return sum1;
> }
> 
> int func () {
> int A[100], B[100];
> int i = 0;
> for (; i < 100; ++i) {
> A[i] = B[i] = i;
> }
> return sum(A,B);
> }
> 
> Arguments to opt : “ -mem2reg -basicaa - scev-aa -print-alias-sets ”
> 
> Output:
> Function: func
> Alias Set Tracker: 2 alias sets for 2 pointer values.
> AliasSet[0x2bc88b0, 2] may alias, Mod/Ref Pointers: (i32*
> %A.arrayidx, 4), (i32* %B.arrayidx2, 4)
> 1 Unknown instructions: i32 %call
> AliasSet[0x2bc8490, 1] must alias, Mod forwarding to 0x2bc88b0
> 
> Function: sum
> Alias Set Tracker: 1 alias sets for 2 pointer values.
> AliasSet[0x2bcbb50, 2] may alias, Ref Pointers: (i32* %A.arrayidx,
> 4), (i32* %B.arrayidx2, 4)
> 
> 
> Thanks,
> Vinay
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory




More information about the llvm-dev mailing list