[LLVMdev] Incorrect result in LLVM Alias Analysis

Adarsh HV adarsh.hv99 at gmail.com
Wed Apr 11 06:39:18 PDT 2012


I have used the follwing command,
opt -load LLVComMan.so -ComMan -memdep -tbaa -mem2reg maptest.ll   -S
What option other than -mem2reg should be included in this case to get the
right results? Does the order in which I specify the optimizations to be run
make a difference?

Duncan Sands wrote:
> 
> Hi Adarsh,
> 
>> I want to check if the values a and b in the program alias.
>>
>> int main() {
>> int *a,*b;
>> a=(int *)malloc(sizeof(int));
>> b=(int *)malloc(sizeof(int));
>> *a=10;
>> *b=8;
>> return 0;
>> }
>>
>> I use the below code for this (getAnalysisUsage method has been defined)
>>
>> AliasAnalysis::Location loc1=AliasAnalysis::Location(k1); //a
>> AliasAnalysis::Location loc2=AliasAnalysis::Location(k2); //b
>> AliasAnalysis::AliasResult ar=AA.alias(loc1,loc2);
>>
>> But I get ar=1 i.e May Alias result. Where am I going wrong?
> 
> did you run a basic set of optimizers first?  Alias analysis assumes that
> at least mem2reg has been run.  Otherwise it returns conservatively
> correct
> but useless answers for everything.
> 
> 
>   I have included
>> -basicaa option in the opt command for running this.
> 
> Ciao, Duncan.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> 

-- 
View this message in context: http://old.nabble.com/Incorrect-result-in-LLVM-Alias-Analysis-tp33642041p33668704.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list