summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-07-16 04:15:34 +0000
committerChris Lattner <sabre@nondot.org>2007-07-16 04:15:34 +0000
commit640fd5124d372aa5997af1d7626bb658b858ee6c (patch)
treefdc878b8dfd5b4ef43971ce76c8f564d0ac1296c /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parentd8bdf533353a055ceda7463aa00a79801505b371 (diff)
downloadbcm5719-llvm-640fd5124d372aa5997af1d7626bb658b858ee6c.tar.gz
bcm5719-llvm-640fd5124d372aa5997af1d7626bb658b858ee6c.zip
Repair a regression in Transforms/InstCombine/mul.ll that Reid noticed.
llvm-svn: 39896
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index f5a85751eaa..77cb18584f9 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -2286,9 +2286,22 @@ static bool isSignBitCheck(ICmpInst::Predicate pred, ConstantInt *RHS,
case ICmpInst::ICMP_SLT: // True if LHS s< 0
TrueIfSigned = true;
return RHS->isZero();
+ case ICmpInst::ICMP_SLE: // True if LHS s<= RHS and RHS == -1
+ TrueIfSigned = true;
+ return RHS->isAllOnesValue();
case ICmpInst::ICMP_SGT: // True if LHS s> -1
TrueIfSigned = false;
return RHS->isAllOnesValue();
+ case ICmpInst::ICMP_UGT:
+ // True if LHS u> RHS and RHS == high-bit-mask - 1
+ TrueIfSigned = true;
+ return RHS->getValue() ==
+ APInt::getSignedMaxValue(RHS->getType()->getPrimitiveSizeInBits());
+ case ICmpInst::ICMP_UGE:
+ // True if LHS u>= RHS and RHS == high-bit-mask (2^7, 2^15, 2^31, etc)
+ TrueIfSigned = true;
+ return RHS->getValue() ==
+ APInt::getSignBit(RHS->getType()->getPrimitiveSizeInBits());
default:
return false;
}
OpenPOWER on IntegriCloud