[LLVMdev] A question about alias analysis

夏一民 ymxia at nudt.edu.cn
Sat Jan 14 22:05:23 PST 2006


Oh, your meaning is pointers in a aliasset have equal address logically?
But I think that two pointers are alias means they point to a same 
memory object, so if pointers "p" and "q" are alias, it seem as p = q, 
not &p = &q.

Another question is about "forwarding". 
"AliasSet[XXXX, 0] may alias, Mod/Ref forwarding to YYYY" (XXXX != YYYY) 
means the address XXXX can be regarded as YYYY in interprocedural analysis, 
and XXXX should be ignored? 

Thank you.

>On Sat, 14 Jan 2006, ymxia wrote:
>> 1. The following is the primary body of my pass "fps.cpp":
>>
>>  AliasAnalysis *AA = &getAnalysis<AliasAnalysis>();
>>  AliasSetTracker AST(*AA);
>>
>>  for (Module::iterator fi = M.begin(), fe = M.end(); fi != fe; ++fi )
>>    for (Function::iterator bi = fi->begin(), be = fi->end(); bi != be; ++bi)
>> 	AST.add(*bi);
>>
>>  for (AliasSetTracker::iterator I = AST.begin(), E = AST.end(); I != E; ++I) {
>> 	AliasSet &AS = *I;
>> 	AS.print (std::cerr);
>>  }
>>
>> 2. The follwoing is the test program "hello.cpp":
>>
>>   int *a, *b;
>>   int main() {
>>      int t;
>>      a = &t;
>>      b = &t;
>>      printf ("%d, %d", a, b);
>>   }
>>
>> 3. I compiled the test program with "llvm-gcc hello.cpp -o hello", and made alias
>>   analysis with:
>>          opt -ds-aa -load ../Debug/lib/fps.so -FPS < hello.bc > /dev/null
>>
>>   opt printed that:
>>   	 AliasSet[XXXX,1] must alis, Mod	Pointers: (sbyte** %a, 4)
>>   	 AliasSet[YYYY,1] must alis, Mod	Pointers: (sbyte** %b, 4)
>>
>>   I donot know why "a" and "b" are not alias? They donot point to a same memory
>> object? But, when I donot use DSAA, that is, "opt -load ../Debug/lib/fps.so -FPS <
>> hello.bc > /dev/null", "a" and "b" are alias!
>
>This is telling you that &a != &b.
>
>-Chris
>
>-- 
>http://nondot.org/sabre/
>http://llvm.org


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060115/0f83ef0c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ¾°Îï3
Type: image/gif
Size: 4515 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060115/0f83ef0c/attachment.gif>


More information about the llvm-dev mailing list