diff options
author | Chris Lattner <sabre@nondot.org> | 2003-11-21 16:52:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-11-21 16:52:05 +0000 |
commit | a29600046d469af2a18ce531ef86c1fc13606464 (patch) | |
tree | 17e38384e5907fe3ce4b013287de842e499bd5aa /llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp | |
parent | cc32e6e62a48ff0e11cdfce5bfeb9659521a05e1 (diff) | |
download | bcm5719-llvm-a29600046d469af2a18ce531ef86c1fc13606464.tar.gz bcm5719-llvm-a29600046d469af2a18ce531ef86c1fc13606464.zip |
Minor cleanups and simplifications
llvm-svn: 10127
Diffstat (limited to 'llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp index 18164220f84..064bba5dddd 100644 --- a/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp +++ b/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp @@ -21,13 +21,12 @@ #include "llvm/iTerminators.h" #include "llvm/iPHINode.h" #include "llvm/Type.h" - -namespace llvm { +using namespace llvm; static RegisterOpt<UnifyFunctionExitNodes> X("mergereturn", "Unify function exit nodes"); -Pass *createUnifyFunctionExitNodesPass() { +Pass *llvm::createUnifyFunctionExitNodesPass() { return new UnifyFunctionExitNodes(); } @@ -91,11 +90,8 @@ 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); - new ReturnInst(PN, NewRetBlock); - } else { - // If it returns void, just add a return void instruction to the block - new ReturnInst(0, NewRetBlock); } + new ReturnInst(PN, NewRetBlock); // Loop over all of the blocks, replacing the return instruction with an // unconditional branch. @@ -109,10 +105,8 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) { if (PN) PN->addIncoming(BB->getTerminator()->getOperand(0), BB); BB->getInstList().pop_back(); // Remove the return insn - new BranchInst(NewRetBlock, 0, 0, BB); + new BranchInst(NewRetBlock, BB); } ReturnBlock = NewRetBlock; return true; } - -} // End llvm namespace |