Disentangle moving a machine instr from updating LiveIntervals.
[oota-llvm.git] / lib / CodeGen / LiveIntervalAnalysis.cpp
index 30374da18f25a98fa92cb4ceef799cf4391f71c3..d27b8e5fd9f5e135ac1424502623cc3b4fee1f95 100644 (file)
@@ -963,22 +963,17 @@ static void handleMoveUses(const MachineBasicBlock *mbb,
   }
 }
 
-void LiveIntervals::moveInstr(MachineBasicBlock::iterator insertPt,
-                              MachineInstr *mi) {
-  MachineBasicBlock* mbb = mi->getParent();
-  assert((insertPt == mbb->end() || insertPt->getParent() == mbb) &&
-         "Cannot handle moves across basic block boundaries.");
-  assert(&*insertPt != mi && "No-op move requested?");
-  assert(!mi->isBundled() && "Can't handle bundled instructions yet.");
-
-  // Grab the original instruction index.
+void LiveIntervals::handleMove(MachineInstr *mi) {
   SlotIndex origIdx = indexes_->getInstructionIndex(mi);
-
-  // Move the machine instr and obtain its new index.
   indexes_->removeMachineInstrFromMaps(mi);
-  mbb->splice(insertPt, mbb, mi);
   SlotIndex miIdx = indexes_->insertMachineInstrInMaps(mi);
 
+  MachineBasicBlock* mbb = mi->getParent();
+  
+  assert(getMBBFromIndex(origIdx) == mbb &&
+         "Cannot handle moves across basic block boundaries.");
+  assert(!mi->isBundled() && "Can't handle bundled instructions yet.");
+
   // Pick the direction.
   bool movingUp = miIdx < origIdx;