[LLVMdev] alias result

Haopeng Liu hyliuhp at gmail.com
Mon Feb 16 10:37:06 PST 2015


t and t2 are two pointers defined in .c file.

The definitions in .bc are:
%thd = alloc i64, align 8
%t = alloca i64*, align 8
%t2 = alloca i64*, align 8

.c file likes this:
int thd;
int *t = &thd;
int *t2 = t;


On 2/16/15 12:28 PM, Hal Finkel wrote:
> ----- Original Message -----
>> From: "Haopeng Liu" <hyliuhp at gmail.com>
>> To: llvmdev at cs.uiuc.edu
>> Sent: Monday, February 16, 2015 12:12:18 PM
>> Subject: [LLVMdev] alias result
>>
>> 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.
> Where do %t and %t2 come from?
>
>   -Hal
>
>> Who can explain these results? Any hits would be appreciated. Thank
>> you.
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>




More information about the llvm-dev mailing list