[llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp
Nick Lewycky
nicholas at mxc.ca
Tue Oct 3 10:36:15 PDT 2006
Changes in directory llvm/lib/Transforms/Scalar:
PredicateSimplifier.cpp updated: 1.18 -> 1.19
---
Log message:
Simplify logic further.
Ensure that we copy KnownProperties before calling visitBasicBlock, else
we may leak properties into blocks where they don't belong.
---
Diffs of the changes: (+8 -17)
PredicateSimplifier.cpp | 25 ++++++++-----------------
1 files changed, 8 insertions(+), 17 deletions(-)
Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp
diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.18 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.19
--- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.18 Tue Oct 3 10:19:11 2006
+++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Tue Oct 3 12:36:01 2006
@@ -650,31 +650,22 @@
BasicBlock *TrueDest = BI->getSuccessor(0),
*FalseDest = BI->getSuccessor(1);
- if (Condition == ConstantBool::getTrue() || TrueDest == FalseDest) {
- proceedToSuccessors(KP, BB);
- return;
- } else if (Condition == ConstantBool::getFalse()) {
+ if (isa<ConstantBool>(Condition) || TrueDest == FalseDest) {
proceedToSuccessors(KP, BB);
return;
}
DTNodeType *Node = DT->getNode(BB);
for (DTNodeType::iterator I = Node->begin(), E = Node->end(); I != E; ++I) {
- if ((*I)->getBlock() == TrueDest) {
- PropertySet TrueProperties(KP);
- TrueProperties.addEqual(ConstantBool::getTrue(), Condition);
- visitBasicBlock(TrueDest, TrueProperties);
- continue;
- }
+ BasicBlock *Dest = (*I)->getBlock();
+ PropertySet DestProperties(KP);
- if ((*I)->getBlock() == FalseDest) {
- PropertySet FalseProperties(KP);
- FalseProperties.addEqual(ConstantBool::getFalse(), Condition);
- visitBasicBlock(FalseDest, FalseProperties);
- continue;
- }
+ if (Dest == TrueDest)
+ DestProperties.addEqual(ConstantBool::getTrue(), Condition);
+ else if (Dest == FalseDest)
+ DestProperties.addEqual(ConstantBool::getFalse(), Condition);
- visitBasicBlock((*I)->getBlock(), KP);
+ visitBasicBlock(Dest, DestProperties);
}
}
More information about the llvm-commits
mailing list