[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
sabre at nondot.org
Sat Jan 13 15:11:56 PST 2007
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.593 -> 1.594
---
Log message:
Fix Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll, which is part
of PR1107: http://llvm.org/PR1107
---
Diffs of the changes: (+13 -3)
InstructionCombining.cpp | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.593 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.594
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.593 Fri Jan 12 01:05:14 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Jan 13 17:11:38 2007
@@ -5263,9 +5263,19 @@
RHSCIOp = CI->getOperand(0);
if (RHSCIOp->getType() != LHSCIOp->getType())
return 0;
- else
- // Okay, just insert a compare of the reduced operands now!
- return new ICmpInst(ICI.getPredicate(), LHSCIOp, RHSCIOp);
+
+ // If the signedness of the two compares doesn't agree (i.e. one is a sext
+ // and the other is a zext), then we can't handle this.
+ if (CI->getOpcode() != LHSCI->getOpcode())
+ return 0;
+
+ // Likewise, if the signedness of the [sz]exts and the compare don't match,
+ // then we can't handle this.
+ if (isSignedExt != isSignedCmp && !ICI.isEquality())
+ return 0;
+
+ // Okay, just insert a compare of the reduced operands now!
+ return new ICmpInst(ICI.getPredicate(), LHSCIOp, RHSCIOp);
}
// If we aren't dealing with a constant on the RHS, exit early
More information about the llvm-commits
mailing list