summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-13 21:55:46 +0000
committerChris Lattner <sabre@nondot.org>2008-07-13 21:55:46 +0000
commiteb388af89f15ee3de6f53359473e1a54418a667f (patch)
treebfa2b91230b6bf57167f826a36d7f68399588750 /lib/Transforms/Utils/SimplifyCFG.cpp
parent867661ac8bd8e202bd4becf9b8e046bf69e150b1 (diff)
downloadllvm-eb388af89f15ee3de6f53359473e1a54418a667f.tar.gz
llvm-eb388af89f15ee3de6f53359473e1a54418a667f.tar.bz2
llvm-eb388af89f15ee3de6f53359473e1a54418a667f.tar.xz
improve comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53531 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 74e83a66a2..ba9332bd06 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1538,6 +1538,9 @@ static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI) {
PHINode *NewPN = PHINode::Create(Type::Int1Ty,
BI->getCondition()->getName() + ".pr",
BB->begin());
+ // Okay, we're going to insert the PHI node. Since PBI is not the only
+ // predecessor, compute the PHI'd conditional value for all of the preds.
+ // Any predecessor where the condition is not computable we keep symbolic.
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
if ((PBI = dyn_cast<BranchInst>((*PI)->getTerminator())) &&
PBI != BI && PBI->isConditional() &&
@@ -1551,7 +1554,6 @@ static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI) {
}
BI->setCondition(NewPN);
- // This will thread the branch.
return true;
}
}
@@ -1653,7 +1655,7 @@ static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI) {
// them agree.
for (BasicBlock::iterator II = CommonDest->begin();
(PN = dyn_cast<PHINode>(II)); ++II) {
- Value * BIV = PN->getIncomingValueForBlock(BB);
+ Value *BIV = PN->getIncomingValueForBlock(BB);
unsigned PBBIdx = PN->getBasicBlockIndex(PBI->getParent());
Value *PBIV = PN->getIncomingValue(PBBIdx);
if (BIV != PBIV) {