diff options
author | Chris Lattner <sabre@nondot.org> | 2004-03-15 04:08:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-03-15 04:08:36 +0000 |
commit | 5b5f7c11d07d1e0d989a82df266c3595b4bd35e9 (patch) | |
tree | c1fe4900181952711638fafb53d47b2f5c18d3f1 /lib/Analysis/AliasSetTracker.cpp | |
parent | c87f0bb345642b7c278b42fa93fb3dc3c8849688 (diff) |
Don't be COMPLETELY pessimistic in the face of function calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AliasSetTracker.cpp')
-rw-r--r-- | lib/Analysis/AliasSetTracker.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index 67cef76d57..d266c2a5a0 100644 --- a/lib/Analysis/AliasSetTracker.cpp +++ b/lib/Analysis/AliasSetTracker.cpp @@ -93,9 +93,21 @@ void AliasSet::addPointer(AliasSetTracker &AST, HashNodePair &Entry, RefCount++; // Entry points to alias set... } -void AliasSet::addCallSite(CallSite CS) { +void AliasSet::addCallSite(CallSite CS, AliasAnalysis &AA) { CallSites.push_back(CS); - AliasTy = MayAlias; // FIXME: Too conservative? + + if (Function *F = CS.getCalledFunction()) { + if (AA.doesNotAccessMemory(F)) + return; + else if (AA.onlyReadsMemory(F)) { + AliasTy = MayAlias; + AccessTy = Refs; + return; + } + } + + // FIXME: This should use mod/ref information to make this not suck so bad + AliasTy = MayAlias; AccessTy = ModRef; } @@ -129,7 +141,11 @@ bool AliasSet::aliasesPointer(const Value *Ptr, unsigned Size, } bool AliasSet::aliasesCallSite(CallSite CS, AliasAnalysis &AA) const { - // FIXME: Too conservative! + // FIXME: Use mod/ref information to prune this better! + if (Function *F = CS.getCalledFunction()) + if (AA.doesNotAccessMemory(F)) + return false; + return true; } @@ -213,7 +229,7 @@ void AliasSetTracker::add(CallSite CS) { AliasSets.push_back(AliasSet()); AS = &AliasSets.back(); } - AS->addCallSite(CS); + AS->addCallSite(CS, AA); } void AliasSetTracker::add(Instruction *I) { |