[LLVMdev] alias result

Haopeng Liu hyliuhp at gmail.com
Mon Feb 16 10:12:18 PST 2015


Hi all,

I am implementing a pass which needs aliasanalysis in llvm.

My pass firstly records all store or load instructions as follows:
loc[cnt++] = AA.getLocation(si/li);

Then, get each pairwise alias result.
AliasAnalysis::AliasResult ar = AA.alias(loc[i], loc[j]);
switch(ar){ case 0,1,2,3;}

And the command is: opt -load mypass.so -mypass -basicaa test.bc

The store/load in test.bc:

(1): store i64* %thd, i64** %t, align 8    //int64 *t = &thd;
(2): %1 = load i64** %t, align 8             //load t
(3): store i64* %1, i64** %t2, align 8     //int64 *t2 = t;
(4): %2 = load i64** %t, align 8             //load t
(5): %3 = load i64** %t2, align 8           //load t2

It seems that all these 5 instructions should be aliased to each other.

But the result should that only (1,2) (1,4) (2,4) (3,5) are must alias. 
Others are no alias.

Who can explain these results? Any hits would be appreciated. Thank you.









More information about the llvm-dev mailing list