Cleanup of the [SU]ADDO type legalization code. Patch by Duncan!
[oota-llvm.git] / lib / Analysis / MemoryDependenceAnalysis.cpp
index 2012ab473c98a697650a37a94129bc67a0c1f347..d5b0afccb9b01c23aae116334727fa5c9cfabe11 100644 (file)
@@ -97,7 +97,7 @@ Instruction* MemoryDependenceAnalysis::getCallSiteDependency(CallSite C,
   BasicBlock::iterator blockBegin = C.getInstruction()->getParent()->begin();
   BasicBlock::iterator QI = C.getInstruction();
   
-  // If the starting point was specifiy, use it
+  // If the starting point was specified, use it
   if (start) {
     QI = start;
     blockBegin = start->getParent()->begin();
@@ -528,6 +528,10 @@ void MemoryDependenceAnalysis::removeInstruction(Instruction* rem) {
       // If we have dep info for rem, set them to it
       BasicBlock::iterator RI = depGraphEntry->second.first;
       RI++;
+      
+      // If RI is rem, then we use rem's immediate successor.
+      if (RI == (BasicBlock::iterator)rem) RI++;
+      
       newDep = RI;
     } else if ( (depGraphEntry->second.first == NonLocal ||
                  depGraphEntry->second.first == None ) &&