diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-01-29 02:43:04 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-01-29 02:43:04 +0000 |
commit | 65b8ccf6ac2c9c639ff91a31c7962c7f92deb266 (patch) | |
tree | 4461d784c4c7ce1ac4d3680a8006afbf72fd5fff /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 2a5fdd4729f922969f694f30096ea46880303a21 (diff) | |
download | bcm5719-llvm-65b8ccf6ac2c9c639ff91a31c7962c7f92deb266.tar.gz bcm5719-llvm-65b8ccf6ac2c9c639ff91a31c7962c7f92deb266.zip |
Revert r124518. It broke Linux self-host.
llvm-svn: 124522
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index acaea195e71..5d3af3759a0 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -509,32 +509,7 @@ void llvm::FindFunctionBackedges(const Function &F, // Go up one level. InStack.erase(VisitStack.pop_back_val().first); } - } while (!VisitStack.empty()); -} - -/// FoldReturnIntoUncondBranch - This method duplicates the specified return -/// instruction into a predecessor which ends in an unconditional branch. If -/// the return instruction returns a value defined by a PHI, propagate the -/// right value into the return. It returns the new return instruction in the -/// predecessor. -ReturnInst *llvm::FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB, - BasicBlock *Pred) { - Instruction *UncondBranch = Pred->getTerminator(); - // Clone the return and add it to the end of the predecessor. - Instruction *NewRet = RI->clone(); - Pred->getInstList().push_back(NewRet); - - // If the return instruction returns a value, and if the value was a - // PHI node in "BB", propagate the right value into the return. - for (User::op_iterator i = NewRet->op_begin(), e = NewRet->op_end(); - i != e; ++i) - if (PHINode *PN = dyn_cast<PHINode>(*i)) - if (PN->getParent() == BB) - *i = PN->getIncomingValueForBlock(Pred); - - // Update any PHI nodes in the returning block to realize that we no - // longer branch to them. - BB->removePredecessor(Pred); - UncondBranch->eraseFromParent(); - return cast<ReturnInst>(NewRet); + } while (!VisitStack.empty()); + + } |