Hello,
I got a strange result when I used alias analysis DSAA, can you tell what is
wrong?
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!
Thanks.
-Xia
On Sat, 14 Jan 2006, [gb2312] ��һ�� 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/
Reasonably Related Threads
- [LLVMdev] A question about alias analysis
- [LLVMdev] A question about alias analysis
- Skip redundant checks in AliasSet::aliasesUnknownInst
- [LLVMdev] AliasSetTracker and UnknownInst's (callsites mostly) problem
- [LLVMdev] Some questions on the output formats of AliasSetTracker