Add a clear() method to PriorityQueue.
[oota-llvm.git] / lib / Transforms / IPO / RaiseAllocations.cpp
index e28400924738b4fe1133bdc1612257b4506e026b..daf8ef00053ef22a69f8d2cc97609ed694093675 100644 (file)
@@ -48,12 +48,11 @@ namespace {
     //
     bool runOnModule(Module &M);
   };
-
-  char RaiseAllocations::ID = 0;
-  RegisterPass<RaiseAllocations>
-  X("raiseallocs", "Raise allocations from calls to instructions");
 }  // end anonymous namespace
 
+char RaiseAllocations::ID = 0;
+static RegisterPass<RaiseAllocations>
+X("raiseallocs", "Raise allocations from calls to instructions");
 
 // createRaiseAllocationsPass - The interface to this file...
 ModulePass *llvm::createRaiseAllocationsPass() {
@@ -165,7 +164,7 @@ bool RaiseAllocations::runOnModule(Module &M) {
           // source size.
           if (Source->getType() != Type::Int32Ty)
             Source = 
-              CastInst::createIntegerCast(Source, Type::Int32Ty, false/*ZExt*/,
+              CastInst::CreateIntegerCast(Source, Type::Int32Ty, false/*ZExt*/,
                                           "MallocAmtCast", I);
 
           MallocInst *MI = new MallocInst(Type::Int8Ty, Source, "", I);
@@ -175,10 +174,10 @@ bool RaiseAllocations::runOnModule(Module &M) {
           // If the old instruction was an invoke, add an unconditional branch
           // before the invoke, which will become the new terminator.
           if (InvokeInst *II = dyn_cast<InvokeInst>(I))
-            new BranchInst(II->getNormalDest(), I);
+            BranchInst::Create(II->getNormalDest(), I);
 
           // Delete the old call site
-          MI->getParent()->getInstList().erase(I);
+          I->eraseFromParent();
           Changed = true;
           ++NumRaised;
         }
@@ -227,7 +226,7 @@ bool RaiseAllocations::runOnModule(Module &M) {
           // If the old instruction was an invoke, add an unconditional branch
           // before the invoke, which will become the new terminator.
           if (InvokeInst *II = dyn_cast<InvokeInst>(I))
-            new BranchInst(II->getNormalDest(), I);
+            BranchInst::Create(II->getNormalDest(), I);
 
           // Delete the old call site
           if (I->getType() != Type::VoidTy)