diff options
author | Chris Lattner <sabre@nondot.org> | 2002-09-10 23:31:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-09-10 23:31:28 +0000 |
commit | 8606d9924b2c1581e45748430be749f1e2934025 (patch) | |
tree | 4dc8fe1ef2339a2c9e94a28b35f3deb03f75a644 /lib/Transforms/Utils/UnifyFunctionExitNodes.cpp | |
parent | 08c2e4838de6b5aebcccb13ef067283c5241f8f2 (diff) |
Fix bugs in previous checkins
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3673 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/UnifyFunctionExitNodes.cpp')
-rw-r--r-- | lib/Transforms/Utils/UnifyFunctionExitNodes.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp index d5a7040f39..f8e959c38c 100644 --- a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp +++ b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp @@ -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->end()); + PHINode *PN = new PHINode(F.getReturnType(), "UnifiedRetVal"); + NewRetBlock->getInstList().push_back(PN); // Add an incoming element to the PHI node for every return instruction that // is merging into this new block... @@ -59,7 +59,7 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) { PN->addIncoming((*I)->getTerminator()->getOperand(0), *I); // Add a return instruction to return the result of the PHI node... - new ReturnInst(PN, NewRetBlock->end()); + NewRetBlock->getInstList().push_back(new ReturnInst(PN)); } else { // If it returns void, just add a return void instruction to the block new ReturnInst(0, NewRetBlock->end()); @@ -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 - new BranchInst(NewRetBlock, (*I)->end()); + (*I)->getInstList().push_back(new BranchInst(NewRetBlock)); } ExitNode = NewRetBlock; return true; |