aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-19 02:07:32 +0000
committerChris Lattner <sabre@nondot.org>2009-01-19 02:07:32 +0000
commit9e0dad4f4168d82ae7604caac5c57e79889a57fc (patch)
treee0238a9c1e8841657398fe24dc77dff8bd6d6971 /lib/Transforms/Utils/SimplifyCFG.cpp
parent6fe73bbcf3b6c1ddfd5e70e8b5188f8df439ace6 (diff)
reduce indentation by using 'continue', no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62477 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 2bd3209b00..b0feadffad 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -221,31 +221,33 @@ static bool TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB,
// Move all PHI nodes in BB to Succ if they are alive, otherwise
// delete them.
- while (PHINode *PN = dyn_cast<PHINode>(&BB->front()))
+ while (PHINode *PN = dyn_cast<PHINode>(&BB->front())) {
if (PN->use_empty()) {
// Just remove the dead phi. This happens if Succ's PHIs were the only
// users of the PHI nodes.
PN->eraseFromParent();
- } else {
- // The instruction is alive, so this means that BB must dominate all
- // predecessors of Succ (Since all uses of the PN are after its
- // definition, so in Succ or a block dominated by Succ. If a predecessor
- // of Succ would not be dominated by BB, PN would violate the def before
- // use SSA demand). Therefore, we can simply move the phi node to the
- // next block.
- Succ->getInstList().splice(Succ->begin(),
- BB->getInstList(), BB->begin());
-
- // We need to add new entries for the PHI node to account for
- // predecessors of Succ that the PHI node does not take into
- // account. At this point, since we know that BB dominated succ and all
- // of its predecessors, this means that we should any newly added
- // incoming edges should use the PHI node itself as the value for these
- // edges, because they are loop back edges.
- for (unsigned i = 0, e = OldSuccPreds.size(); i != e; ++i)
- if (OldSuccPreds[i] != BB)
- PN->addIncoming(PN, OldSuccPreds[i]);
+ continue;
}
+
+ // The instruction is alive, so this means that BB must dominate all
+ // predecessors of Succ (Since all uses of the PN are after its
+ // definition, so in Succ or a block dominated by Succ. If a predecessor
+ // of Succ would not be dominated by BB, PN would violate the def before
+ // use SSA demand). Therefore, we can simply move the phi node to the
+ // next block.
+ Succ->getInstList().splice(Succ->begin(),
+ BB->getInstList(), BB->begin());
+
+ // We need to add new entries for the PHI node to account for
+ // predecessors of Succ that the PHI node does not take into
+ // account. At this point, since we know that BB dominated succ and all
+ // of its predecessors, this means that we should any newly added
+ // incoming edges should use the PHI node itself as the value for these
+ // edges, because they are loop back edges.
+ for (unsigned i = 0, e = OldSuccPreds.size(); i != e; ++i)
+ if (OldSuccPreds[i] != BB)
+ PN->addIncoming(PN, OldSuccPreds[i]);
+ }
}
// Everything that jumped to BB now goes to Succ.