Make it illegal to call getDependency* on non-memory instructions
like binary operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60600 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp
index c47ec04..c75cbf2 100644
--- a/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -118,10 +118,11 @@
MemPtr = F->getPointerOperand();
// FreeInsts erase the entire structure, not just a field.
MemSize = ~0UL;
- } else if (isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst))
+ } else {
+ assert((isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst)) &&
+ "Can only get dependency info for memory instructions!");
return getCallSiteDependency(CallSite::get(QueryInst), ScanIt, BB);
- else // Non-memory instructions depend on nothing.
- return MemDepResult::getNone();
+ }
// Walk backwards through the basic block, looking for dependencies
while (ScanIt != BB->begin()) {