Make the role of MVT::i32 clearer here, and add a
[oota-llvm.git] / lib / CodeGen / BranchFolding.cpp
index 87a77bb14f2089d7c4c6b85e97c5b2f1209963e9..f6b3d9cada5066d602eb1ffcb4ae93055ef09d6b 100644 (file)
@@ -127,7 +127,7 @@ void BranchFolder::RemoveDeadBlock(MachineBasicBlock *MBB) {
   }
   
   // Remove the block.
-  MF->getBasicBlockList().erase(MBB);
+  MF->erase(MBB);
 }
 
 /// OptimizeImpDefsBlock - If a basic block is just a bunch of implicit_def
@@ -375,10 +375,12 @@ void BranchFolder::ReplaceTailWithBranchTo(MachineBasicBlock::iterator OldInst,
 /// iterator.  This returns the new MBB.
 MachineBasicBlock *BranchFolder::SplitMBBAt(MachineBasicBlock &CurMBB,
                                             MachineBasicBlock::iterator BBI1) {
+  MachineFunction &MF = *CurMBB.getParent();
+
   // Create the fall-through block.
   MachineFunction::iterator MBBI = &CurMBB;
-  MachineBasicBlock *NewMBB = new MachineBasicBlock(CurMBB.getBasicBlock());
-  CurMBB.getParent()->getBasicBlockList().insert(++MBBI, NewMBB);
+  MachineBasicBlock *NewMBB =MF.CreateMachineBasicBlock(CurMBB.getBasicBlock());
+  CurMBB.getParent()->insert(++MBBI, NewMBB);
 
   // Move all the successors of this block to the specified block.
   NewMBB->transferSuccessors(&CurMBB);