summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-03-31 05:14:34 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-03-31 05:14:34 +0000
commit56df0ec61033a5bb49b3620e70cc6a61e26b3e7a (patch)
tree5a2e2fe08b8e20bc2b51e882099704fc51e0d0d0 /llvm/lib/Analysis/ValueTracking.cpp
parentc9d6d8b106270aca855e6b4bb307db9c13c298a5 (diff)
downloadbcm5719-llvm-56df0ec61033a5bb49b3620e70cc6a61e26b3e7a.tar.gz
bcm5719-llvm-56df0ec61033a5bb49b3620e70cc6a61e26b3e7a.zip
[InstCombine] Fix incorrect rule from rL236202
The rule for SMIN introduced in rL236202 doesn't work as advertised: the check for Pred == ICmpInst::ICMP_SGT was missing. llvm-svn: 264996
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index e464ae7d69e..802bc117495 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -3552,7 +3552,8 @@ static SelectPatternResult matchSelectPattern(CmpInst::Predicate Pred,
// Y >s C ? ~Y : ~C == ~Y <s ~C ? ~Y : ~C = SMIN(~Y, ~C)
if (const auto *C2 = dyn_cast<ConstantInt>(FalseVal)) {
- if (C1->getType() == C2->getType() && ~C1->getValue() == C2->getValue() &&
+ if (Pred == ICmpInst::ICMP_SGT && C1->getType() == C2->getType() &&
+ ~C1->getValue() == C2->getValue() &&
(match(TrueVal, m_Not(m_Specific(CmpLHS))) ||
match(CmpLHS, m_Not(m_Specific(TrueVal))))) {
LHS = TrueVal;
OpenPOWER on IntegriCloud