[llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp InlineFunction.cpp UnifyFunctionExitNodes.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Nov 20 12:26:22 PST 2003


Changes in directory llvm/lib/Transforms/Utils:

BreakCriticalEdges.cpp updated: 1.15 -> 1.16
InlineFunction.cpp updated: 1.16 -> 1.17
UnifyFunctionExitNodes.cpp updated: 1.27 -> 1.28

---
Log message:

Start using the nicer terminator auto-insertion API



---
Diffs of the changes:  (+7 -8)

Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp
diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.15 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.16
--- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.15	Tue Nov 11 16:41:34 2003
+++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp	Thu Nov 20 12:25:23 2003
@@ -106,8 +106,7 @@
   BasicBlock *NewBB = new BasicBlock(TIBB->getName() + "." +
                                      DestBB->getName() + "_crit_edge");
   // Create our unconditional branch...
-  BranchInst *BI = new BranchInst(DestBB);
-  NewBB->getInstList().push_back(BI);
+  new BranchInst(DestBB, 0, 0, NewBB);
   
   // Branch to the new block, breaking the edge...
   TI->setSuccessor(SuccNum, NewBB);


Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.16 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.17
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.16	Tue Nov 11 16:41:34 2003
+++ llvm/lib/Transforms/Utils/InlineFunction.cpp	Thu Nov 20 12:25:23 2003
@@ -238,7 +238,7 @@
         // invoke site.  Once this happens, we know that the unwind would cause
         // a control transfer to the invoke exception destination, so we can
         // transform it into a direct branch to the exception destination.
-        BranchInst *BI = new BranchInst(InvokeDest, UI);
+        new BranchInst(InvokeDest, UI);
 
         // Delete the unwind instruction!
         UI->getParent()->getInstList().pop_back();


Index: llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
diff -u llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.27 llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.28
--- llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp:1.27	Tue Nov 11 16:41:34 2003
+++ llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp	Thu Nov 20 12:25:23 2003
@@ -61,13 +61,13 @@
     UnwindBlock = UnwindingBlocks.front();
   } else {
     UnwindBlock = new BasicBlock("UnifiedUnwindBlock", &F);
-    UnwindBlock->getInstList().push_back(new UnwindInst());
+    new UnwindInst(UnwindBlock);
 
     for (std::vector<BasicBlock*>::iterator I = UnwindingBlocks.begin(), 
            E = UnwindingBlocks.end(); I != E; ++I) {
       BasicBlock *BB = *I;
       BB->getInstList().pop_back();  // Remove the return insn
-      BB->getInstList().push_back(new BranchInst(UnwindBlock));
+      new BranchInst(UnwindBlock, 0, 0, BB);
     }
   }
 
@@ -91,10 +91,10 @@
     // If the function doesn't return void... add a PHI node to the block...
     PN = new PHINode(F.getReturnType(), "UnifiedRetVal");
     NewRetBlock->getInstList().push_back(PN);
-    NewRetBlock->getInstList().push_back(new ReturnInst(PN));
+    new ReturnInst(PN, NewRetBlock);
   } else {
     // If it returns void, just add a return void instruction to the block
-    NewRetBlock->getInstList().push_back(new ReturnInst());
+    new ReturnInst(0, NewRetBlock);
   }
 
   // Loop over all of the blocks, replacing the return instruction with an
@@ -109,7 +109,7 @@
     if (PN) PN->addIncoming(BB->getTerminator()->getOperand(0), BB);
 
     BB->getInstList().pop_back();  // Remove the return insn
-    BB->getInstList().push_back(new BranchInst(NewRetBlock));
+    new BranchInst(NewRetBlock, 0, 0, BB);
   }
   ReturnBlock = NewRetBlock;
   return true;





More information about the llvm-commits mailing list