[LLVMdev] alias analysis results
Weihua Sheng
weihua.sheng at gmail.com
Thu May 14 14:19:21 PDT 2009
Hi there,
I am trying to understand how AliasAnalysis works out in LLVM. I used
the following simple test-case (test4.c):
--
void test()
{
int *jj, *kk;
int aa = 100;
jj = &aa;
*jj = 300;
}
int main()
{
test();
return 0;
}
--
Then I did "llvm-gcc -emit-llvm -c -o test4.bc test4.c" to get bc. I
tried the following 2 ways to get what I expect to get as
"alias-sets":
1. opt -aa-eval -print-all-alias-modref-info test4.bc
Function: test: 4 pointers, 0 call sites
NoAlias: i32* %aa, i32** %kk
NoAlias: i32* %aa, i32** %jj
NoAlias: i32** %jj, i32** %kk
MayAlias: i32* %0, i32* %aa
MayAlias: i32* %0, i32** %kk
MayAlias: i32* %0, i32** %jj
Function: main: 2 pointers, 1 call sites
NoAlias: i32* %0, i32* %retval
NoModRef: Ptr: i32* %retval <-> call void @test() nounwind
NoModRef: Ptr: i32* %0 <-> call void @test() nounwind
This way at least I could see " aa <- (kk, jj)" results from mayalias.
2. opt -anders-aa -aa-eval -print-all-alias-modref-info test4.bc
Function: test: 4 pointers, 0 call sites
NoAlias: i32* %aa, i32** %kk
NoAlias: i32* %aa, i32** %jj
NoAlias: i32** %jj, i32** %kk
MayAlias: i32* %0, i32* %aa
NoAlias: i32* %0, i32** %kk
NoAlias: i32* %0, i32** %jj
Function: main: 2 pointers, 1 call sites
NoAlias: i32* %0, i32* %retval
NoModRef: Ptr: i32* %retval <-> call void @test() nounwind
NoModRef: Ptr: i32* %0 <-> call void @test() nounwind
I actullay would expect the more accurate results from applying
anders-aa, but I could not interpret what has been returned - at least
I should see something like jj->aa, right?
Maybe I missed something out, could someone on the mailing list share
some thoughts?
Thanks a lot!
Weihua
More information about the llvm-dev
mailing list