[llvm-commits] [llvm] r60600 - in /llvm/trunk: include/llvm/Analysis/MemoryDependenceAnalysis.h lib/Analysis/MemoryDependenceAnalysis.cpp

Chris Lattner sabre at nondot.org
Fri Dec 5 10:46:19 PST 2008


Author: lattner
Date: Fri Dec  5 12:46:19 2008
New Revision: 60600

URL: http://llvm.org/viewvc/llvm-project?rev=60600&view=rev
Log:
Make it illegal to call getDependency* on non-memory instructions
like binary operators.

Modified:
    llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
    llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp

Modified: llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h?rev=60600&r1=60599&r2=60600&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h Fri Dec  5 12:46:19 2008
@@ -180,7 +180,8 @@
     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

Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=60600&r1=60599&r2=60600&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Fri Dec  5 12:46:19 2008
@@ -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()) {





More information about the llvm-commits mailing list