Clean up code due to auto-insert constructors
authorChris Lattner <sabre@nondot.org>
Tue, 10 Sep 2002 22:38:49 +0000 (22:38 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 10 Sep 2002 22:38:49 +0000 (22:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3666 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/InlineSimple.cpp
lib/Transforms/Utils/UnifyFunctionExitNodes.cpp

index 924ad5c93afce27dcbd931a76877f1409733cd6d..54092ae91b4a328fdb099ab71df0a71803a444d6 100644 (file)
@@ -93,12 +93,11 @@ bool InlineFunction(CallInst *CI) {
   //
   PHINode *PHI = 0;
   if (CalledFunc->getReturnType() != Type::VoidTy) {
-    PHI = new PHINode(CalledFunc->getReturnType(), CI->getName());
-
     // The PHI node should go at the front of the new basic block to merge all 
     // possible incoming values.
     //
-    NewBB->getInstList().push_front(PHI);
+    PHI = new PHINode(CalledFunc->getReturnType(), CI->getName(),
+                      NewBB->begin());
 
     // Anything that used the result of the function call should now use the PHI
     // node as their operand.
@@ -164,7 +163,7 @@ bool InlineFunction(CallInst *CI) {
       }
 
       // Add a branch to the code that was after the original Call.
-      IBB->getInstList().push_back(new BranchInst(NewBB));
+      new BranchInst(NewBB, IBB->end());
       break;
     }
     case Instruction::Br:
index 3c522b53ab03e1300210a2ba8dcd12256eb0140b..5c1e86b4a16e4c740c1003299b396fd906c9d9b8 100644 (file)
@@ -49,8 +49,8 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) {
 
   if (F.getReturnType() != Type::VoidTy) {
     // If the function doesn't return void... add a PHI node to the block...
-    PHINode *PN = new PHINode(F.getReturnType(), "UnifiedRetVal");
-    NewRetBlock->getInstList().push_back(PN);
+    PHINode *PN = new PHINode(F.getReturnType(), "UnifiedRetVal",
+                              NewRetBlock.end());
 
     // Add an incoming element to the PHI node for every return instruction that
     // is merging into this new block...
@@ -59,10 +59,10 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) {
       PN->addIncoming((*I)->getTerminator()->getOperand(0), *I);
 
     // Add a return instruction to return the result of the PHI node...
-    NewRetBlock->getInstList().push_back(new ReturnInst(PN));
+    new ReturnInst(PN, NewRetBlock.end());
   } else {
     // If it returns void, just add a return void instruction to the block
-    NewRetBlock->getInstList().push_back(new ReturnInst());
+    new ReturnInst(0, NewRetBlock.end());
   }
 
   // Loop over all of the blocks, replacing the return instruction with an
@@ -71,7 +71,7 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) {
   for (vector<BasicBlock*>::iterator I = ReturningBlocks.begin(), 
                                      E = ReturningBlocks.end(); I != E; ++I) {
     (*I)->getInstList().pop_back();  // Remove the return insn
-    (*I)->getInstList().push_back(new BranchInst(NewRetBlock));
+    new BranchInst(NewRetBlock, (*I)->end());
   }
   ExitNode = NewRetBlock;
   return true;