diff options
| -rw-r--r-- | llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h | 3 | ||||
| -rw-r--r-- | llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | 7 | 
2 files changed, 6 insertions, 4 deletions
| diff --git a/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h b/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h index 5e0612177e2..b9138ef8085 100644 --- a/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h +++ b/llvm/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/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index c47ec0493a5..c75cbf2c59f 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/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()) { | 

