[llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp
Nick Lewycky
nicholas at mxc.ca
Mon Sep 11 10:23:48 PDT 2006
Changes in directory llvm/lib/Transforms/Scalar:
PredicateSimplifier.cpp updated: 1.6 -> 1.7
---
Log message:
Skip the linear search if the answer is already known.
---
Diffs of the changes: (+22 -20)
PredicateSimplifier.cpp | 42 ++++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 20 deletions(-)
Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp
diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.6 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.7
--- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.6 Sat Sep 9 21:27:07 2006
+++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Mon Sep 11 12:23:34 2006
@@ -501,30 +501,32 @@
Value *SCI0 = resolve(SCI->getOperand(0), KP),
*SCI1 = resolve(SCI->getOperand(1), KP);
- PropertySet::ConstPropertyIterator NE =
- KP.findProperty(PropertySet::NE, SCI0, SCI1);
-
- if (NE != KP.Properties.end()) {
- switch (SCI->getOpcode()) {
- case Instruction::SetEQ:
- return ConstantBool::False;
- case Instruction::SetNE:
- return ConstantBool::True;
- case Instruction::SetLE:
- case Instruction::SetGE:
- case Instruction::SetLT:
- case Instruction::SetGT:
- break;
- default:
- assert(0 && "Unknown opcode in SetCondInst.");
- break;
- }
- }
ConstantIntegral *CI1 = dyn_cast<ConstantIntegral>(SCI0),
*CI2 = dyn_cast<ConstantIntegral>(SCI1);
- if (!CI1 || !CI2) return SCI;
+ if (!CI1 || !CI2) {
+ PropertySet::ConstPropertyIterator NE =
+ KP.findProperty(PropertySet::NE, SCI0, SCI1);
+
+ if (NE != KP.Properties.end()) {
+ switch (SCI->getOpcode()) {
+ case Instruction::SetEQ:
+ return ConstantBool::False;
+ case Instruction::SetNE:
+ return ConstantBool::True;
+ case Instruction::SetLE:
+ case Instruction::SetGE:
+ case Instruction::SetLT:
+ case Instruction::SetGT:
+ break;
+ default:
+ assert(0 && "Unknown opcode in SetCondInst.");
+ break;
+ }
+ }
+ return SCI;
+ }
switch(SCI->getOpcode()) {
case Instruction::SetLE:
More information about the llvm-commits
mailing list