aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-20 18:25:24 +0000
committerChris Lattner <sabre@nondot.org>2003-11-20 18:25:24 +0000
commitf8485c643412dbff46fe87ea2867445169a5c28e (patch)
tree47df4c3a7138fa1f6051e38e3faf81613862b616 /lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
parentadbc0b5287bf36893cdcae2440d48b3cb3489e38 (diff)
Start using the nicer terminator auto-insertion API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/UnifyFunctionExitNodes.cpp')
-rw-r--r--lib/Transforms/Utils/UnifyFunctionExitNodes.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
index 2591ffd6d7..18164220f8 100644
--- a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
+++ b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
@@ -61,13 +61,13 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) {
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 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) {
// 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 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) {
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;