Use context-sensitive alias analysis to avoid pessimization in clients of

AliasSetTracker (dse and licm).  This implements
DeadStoreElimination/context-sensitive.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15254 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-07-27 02:20:26 +00:00
parent cbb4b574c0
commit efe30ef790

View File

@ -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;
}