diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-27 07:54:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-27 07:54:12 +0000 |
commit | 3c4f8b91eff129f25327a03634da5386962b9d84 (patch) | |
tree | dda155b7329bf7fb86946e2c91c87e96ea6dc424 /lib/Transforms/Scalar/CodeGenPrepare.cpp | |
parent | b29714a10af94b6daae437e48a82ae32675f79cb (diff) | |
download | llvm-3c4f8b91eff129f25327a03634da5386962b9d84.tar.gz llvm-3c4f8b91eff129f25327a03634da5386962b9d84.tar.bz2 llvm-3c4f8b91eff129f25327a03634da5386962b9d84.tar.xz |
Use the new MergeBasicBlockIntoOnlyPred function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60163 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r-- | lib/Transforms/Scalar/CodeGenPrepare.cpp | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index 93252c8b3b..caf60c8c7a 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -205,25 +205,7 @@ void CodeGenPrepare::EliminateMostlyEmptyBlock(BasicBlock *BB) { // If the destination block has a single pred, then this is a trivial edge, // just collapse it. if (DestBB->getSinglePredecessor()) { - // If DestBB has single-entry PHI nodes, fold them. - while (PHINode *PN = dyn_cast<PHINode>(DestBB->begin())) { - Value *NewVal = PN->getIncomingValue(0); - // Replace self referencing PHI with undef, it must be dead. - if (NewVal == PN) NewVal = UndefValue::get(PN->getType()); - PN->replaceAllUsesWith(NewVal); - PN->eraseFromParent(); - } - - // Splice all the PHI nodes from BB over to DestBB. - DestBB->getInstList().splice(DestBB->begin(), BB->getInstList(), - BB->begin(), BI); - - // Anything that branched to BB now branches to DestBB. - BB->replaceAllUsesWith(DestBB); - - // Nuke BB. - BB->eraseFromParent(); - + MergeBasicBlockIntoOnlyPred(DestBB); DOUT << "AFTER:\n" << *DestBB << "\n\n\n"; return; } |