summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-12-08 18:30:43 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-12-08 18:30:43 +0000
commitd5b3aa49acc264186efce781a0a4fb30fbfb9273 (patch)
treed9d1d462836760051c11dd6445b1a7c92bcac3af /llvm/lib/Analysis/InstructionSimplify.cpp
parent32745dde08f5dd51df7e331cd7df830107941344 (diff)
downloadbcm5719-llvm-d5b3aa49acc264186efce781a0a4fb30fbfb9273.tar.gz
bcm5719-llvm-d5b3aa49acc264186efce781a0a4fb30fbfb9273.zip
InstSimplify: Try to bring back the rest of r223583
This reverts r223624 with a small tweak, hopefully this will make stage3 equivalent. llvm-svn: 223679
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 5c536aa79c4..2cf1661cfd9 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -1448,8 +1448,8 @@ static Value *simplifyUnsignedRangeCheck(ICmpInst *ZeroICmp,
Value *X, *Y;
ICmpInst::Predicate EqPred;
- if (!match(ZeroICmp, m_ICmp(EqPred, m_Value(Y), m_Zero())) &&
- ICmpInst::isEquality(EqPred))
+ if (!match(ZeroICmp, m_ICmp(EqPred, m_Value(Y), m_Zero())) ||
+ !ICmpInst::isEquality(EqPred))
return nullptr;
ICmpInst::Predicate UnsignedPred;
@@ -1476,6 +1476,11 @@ static Value *simplifyUnsignedRangeCheck(ICmpInst *ZeroICmp,
return UnsignedICmp;
}
+ // X < Y && Y == 0 --> false
+ if (UnsignedPred == ICmpInst::ICMP_ULT && EqPred == ICmpInst::ICMP_EQ &&
+ IsAnd)
+ return getFalse(UnsignedICmp->getType());
+
return nullptr;
}
OpenPOWER on IntegriCloud