[llvm-commits] [llvm] r60639 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
Chris Lattner
sabre at nondot.org
Sat Dec 6 16:21:18 PST 2008
Author: lattner
Date: Sat Dec 6 18:21:18 2008
New Revision: 60639
URL: http://llvm.org/viewvc/llvm-project?rev=60639&view=rev
Log:
remove the ability to get memdep info for vaarg. I don't think the
original impl was correct and noone actually makes the query anyway.
Modified:
llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=60639&r1=60638&r2=60639&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Sat Dec 6 18:21:18 2008
@@ -109,6 +109,10 @@
MemDepResult MemoryDependenceAnalysis::
getDependencyFrom(Instruction *QueryInst, BasicBlock::iterator ScanIt,
BasicBlock *BB) {
+ // The first instruction in a block is always non-local.
+ if (ScanIt == BB->begin())
+ return MemDepResult::getNonLocal();
+
// Get the pointer value for which dependence will be determined
Value *MemPtr = 0;
uint64_t MemSize = 0;
@@ -122,17 +126,16 @@
MemPtr = LI->getPointerOperand();
MemSize = TD->getTypeStoreSize(LI->getType());
MemVolatile = LI->isVolatile();
- } else if (VAArgInst* V = dyn_cast<VAArgInst>(QueryInst)) {
- MemPtr = V->getOperand(0);
- MemSize = TD->getTypeStoreSize(V->getType());
} else if (FreeInst* F = dyn_cast<FreeInst>(QueryInst)) {
MemPtr = F->getPointerOperand();
// FreeInsts erase the entire structure, not just a field.
MemSize = ~0UL;
- } else {
- assert((isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst)) &&
- "Can only get dependency info for memory instructions!");
+ } else if (isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst)) {
return getCallSiteDependency(CallSite::get(QueryInst), ScanIt, BB);
+ } else {
+ // Otherwise, this is a vaarg or non-memory instruction, just return a
+ // clobber dependency on the previous inst.
+ return MemDepResult::getClobber(--ScanIt);
}
// Walk backwards through the basic block, looking for dependencies
More information about the llvm-commits
mailing list