[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Jan 31 19:24:02 PST 2004
Changes in directory llvm/lib/VMCore:
ConstantFolding.cpp updated: 1.50 -> 1.51
---
Log message:
Fix a crasher bug in my constant folding rewrite
---
Diffs of the changes: (+10 -3)
Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.50 llvm/lib/VMCore/ConstantFolding.cpp:1.51
--- llvm/lib/VMCore/ConstantFolding.cpp:1.50 Mon Jan 12 23:51:55 2004
+++ llvm/lib/VMCore/ConstantFolding.cpp Sat Jan 31 19:23:19 2004
@@ -625,11 +625,18 @@
// If the first operand is simple, swap operands.
assert((isa<ConstantPointerRef>(V2) || isa<ConstantExpr>(V2)) &&
"Simple cases should have been handled by caller!");
- return SetCondInst::getSwappedCondition(evaluateRelation(V2, V1));
+ Instruction::BinaryOps SwappedRelation = evaluateRelation(V2, V1);
+ if (SwappedRelation != Instruction::BinaryOpsEnd)
+ return SetCondInst::getSwappedCondition(SwappedRelation);
} else if (const ConstantPointerRef *CPR1 = dyn_cast<ConstantPointerRef>(V1)){
- if (isa<ConstantExpr>(V2)) // Swap as necessary.
- return SetCondInst::getSwappedCondition(evaluateRelation(V2, V1));
+ if (isa<ConstantExpr>(V2)) { // Swap as necessary.
+ Instruction::BinaryOps SwappedRelation = evaluateRelation(V2, V1);
+ if (SwappedRelation != Instruction::BinaryOpsEnd)
+ return SetCondInst::getSwappedCondition(SwappedRelation);
+ else
+ return Instruction::BinaryOpsEnd;
+ }
// Now we know that the RHS is a ConstantPointerRef or simple constant,
// which (since the types must match) means that it's a ConstantPointerNull.
More information about the llvm-commits
mailing list