diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-07-27 02:20:26 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-07-27 02:20:26 +0000 |
| commit | 9b323c35219a47fa9712c6758be21530e6f3f3ac (patch) | |
| tree | beb429c3f1ef250813d3508f975ba9f2579a5b1d /llvm/lib/Analysis | |
| parent | 0a0fc220cc20169f1e95afc2dbff4fee718c6acd (diff) | |
| download | bcm5719-llvm-9b323c35219a47fa9712c6758be21530e6f3f3ac.tar.gz bcm5719-llvm-9b323c35219a47fa9712c6758be21530e6f3f3ac.zip | |
Use context-sensitive alias analysis to avoid pessimization in clients of
AliasSetTracker (dse and licm). This implements
DeadStoreElimination/context-sensitive.llx
llvm-svn: 15254
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/AliasSetTracker.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp index 867e58adcc6..fedc2790744 100644 --- a/llvm/lib/Analysis/AliasSetTracker.cpp +++ b/llvm/lib/Analysis/AliasSetTracker.cpp @@ -138,20 +138,38 @@ bool AliasSet::aliasesPointer(const Value *Ptr, unsigned Size, return true; // Check the call sites list and invoke list... - if (!CallSites.empty()) - // FIXME: this is pessimistic! - return true; + if (!CallSites.empty()) { + if (AA.hasNoModRefInfoForCalls()) + return true; + + for (unsigned i = 0, e = CallSites.size(); i != e; ++i) + if (AA.getModRefInfo(CallSites[i], const_cast<Value*>(Ptr), Size) + != AliasAnalysis::NoModRef) + return true; + } return false; } bool AliasSet::aliasesCallSite(CallSite CS, AliasAnalysis &AA) const { - // FIXME: Use mod/ref information to prune this better! if (Function *F = CS.getCalledFunction()) if (AA.doesNotAccessMemory(F)) return false; - return true; + if (AA.hasNoModRefInfoForCalls()) + return true; + + for (unsigned i = 0, e = CallSites.size(); i != e; ++i) + if (AA.getModRefInfo(CallSites[i], CS) != AliasAnalysis::NoModRef || + AA.getModRefInfo(CS, CallSites[i]) != AliasAnalysis::NoModRef) + return true; + + for (iterator I = begin(), E = end(); I != E; ++I) + if (AA.getModRefInfo(CS, I.getPointer(), I.getSize()) != + AliasAnalysis::NoModRef) + return true; + + return false; } |

