aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-05 18:46:19 +0000
committerChris Lattner <sabre@nondot.org>2008-12-05 18:46:19 +0000
commita5a5450d3ee27ab0319491335eadc5f1c8b96686 (patch)
tree083b2188be6f984863a4f049e302dcb5c65558ff
parenteb7a09bd42ba8da2be271860ae3500b409546c67 (diff)
downloadexternal_llvm-a5a5450d3ee27ab0319491335eadc5f1c8b96686.zip
external_llvm-a5a5450d3ee27ab0319491335eadc5f1c8b96686.tar.gz
external_llvm-a5a5450d3ee27ab0319491335eadc5f1c8b96686.tar.bz2
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
-rw-r--r--include/llvm/Analysis/MemoryDependenceAnalysis.h3
-rw-r--r--lib/Analysis/MemoryDependenceAnalysis.cpp7
2 files changed, 6 insertions, 4 deletions
diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h
index 5e06121..b9138ef 100644
--- a/include/llvm/Analysis/MemoryDependenceAnalysis.h
+++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h
@@ -180,7 +180,8 @@ namespace llvm {
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
/// getDependency - Return the instruction on which a memory operation
- /// depends. See the class comment for more details.
+ /// depends. See the class comment for more details. It is illegal to call
+ /// this on non-memory instructions.
MemDepResult getDependency(Instruction *QueryInst);
/// getDependencyFrom - Return the instruction on which the memory operation
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 @@ getDependencyFrom(Instruction *QueryInst, BasicBlock::iterator ScanIt,
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()) {