summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-22 23:47:13 +0000
committerChris Lattner <sabre@nondot.org>2007-11-22 23:47:13 +0000
commit1985d96dc9323741a9f579a1929c0e044db073e6 (patch)
treeee3c3574b9f0369443fb06b6bc01512f07b8a98c /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parenta717ce7c70370edfd67a74f9e662659ad3814dc9 (diff)
downloadbcm5719-llvm-1985d96dc9323741a9f579a1929c0e044db073e6.tar.gz
bcm5719-llvm-1985d96dc9323741a9f579a1929c0e044db073e6.zip
Fix PR1817.
llvm-svn: 44284
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index e8cd86778ae..c8df4128643 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -3463,7 +3463,12 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
LHSCC != ICmpInst::ICMP_UGE && LHSCC != ICmpInst::ICMP_ULE &&
RHSCC != ICmpInst::ICMP_UGE && RHSCC != ICmpInst::ICMP_ULE &&
LHSCC != ICmpInst::ICMP_SGE && LHSCC != ICmpInst::ICMP_SLE &&
- RHSCC != ICmpInst::ICMP_SGE && RHSCC != ICmpInst::ICMP_SLE) {
+ RHSCC != ICmpInst::ICMP_SGE && RHSCC != ICmpInst::ICMP_SLE &&
+
+ // Don't try to fold ICMP_SLT + ICMP_ULT.
+ (ICmpInst::isEquality(LHSCC) || ICmpInst::isEquality(RHSCC) ||
+ ICmpInst::isSignedPredicate(LHSCC) ==
+ ICmpInst::isSignedPredicate(RHSCC))) {
// Ensure that the larger constant is on the RHS.
ICmpInst::Predicate GT = ICmpInst::isSignedPredicate(LHSCC) ?
ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
OpenPOWER on IntegriCloud