summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-09-30 06:08:34 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-09-30 06:08:34 +0000
commite8ced3ec192edfa2dc939c6f720fe358a03174fc (patch)
treecc3bec23439d48514a182f77daaad0fd324d5591 /llvm/lib
parenta930b5625249cc74e610b042b8ef7a0693bc3a29 (diff)
downloadbcm5719-llvm-e8ced3ec192edfa2dc939c6f720fe358a03174fc.tar.gz
bcm5719-llvm-e8ced3ec192edfa2dc939c6f720fe358a03174fc.zip
Fix misoptimization of: xor i1 (icmp eq (X, C1), icmp s[lg]t (X, C2))
llvm-svn: 56834
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 9023db7d508..6cac395405b 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -3023,7 +3023,7 @@ Instruction *InstCombiner::visitSRem(BinaryOperator &I) {
I.setOperand(1, RHSNeg);
return &I;
}
-
+
// If the sign bits of both operands are zero (i.e. we can prove they are
// unsigned inputs), turn this into a urem.
if (I.getType()->isInteger()) {
@@ -4205,7 +4205,8 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
// Ensure that the larger constant is on the RHS.
ICmpInst *LHS = cast<ICmpInst>(Op0);
bool NeedsSwap;
- if (ICmpInst::isSignedPredicate(LHSCC))
+ if (ICmpInst::isEquality(LHSCC) ? ICmpInst::isSignedPredicate(RHSCC)
+ : ICmpInst::isSignedPredicate(LHSCC))
NeedsSwap = LHSCst->getValue().sgt(RHSCst->getValue());
else
NeedsSwap = LHSCst->getValue().ugt(RHSCst->getValue());
OpenPOWER on IntegriCloud