aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-12-08 14:31:49 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-12-08 14:31:49 +0000
commitcfd499024808f4e0f3a349db451babd5a5ebf4e1 (patch)
treefc2454a4dc6fcef3d2834e096c3ca29fbba04825 /lib/Transforms/InstCombine
parentd17fea9f4160084012c9596029dfeba3220a5ff3 (diff)
downloadsrc-cfd499024808f4e0f3a349db451babd5a5ebf4e1.tar.gz
src-cfd499024808f4e0f3a349db451babd5a5ebf4e1.zip
Notes
Notes: svn path=/vendor/llvm/dist-release_70/; revision=341728 svn path=/vendor/llvm/llvm-release_701-r349250/; revision=342116; tag=vendor/llvm/llvm-release_701-r349250
Diffstat (limited to 'lib/Transforms/InstCombine')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCompares.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 6de92a4842ab..e1bae11b40d1 100644
--- a/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2924,12 +2924,20 @@ static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I,
// x & (-1 >> y) s>= x -> x s<= (-1 >> y)
if (X != I.getOperand(1)) // X must be on RHS of comparison!
return nullptr; // Ignore the other case.
+ if (!match(M, m_Constant())) // Can not do this fold with non-constant.
+ return nullptr;
+ if (!match(M, m_NonNegative())) // Must not have any -1 vector elements.
+ return nullptr;
DstPred = ICmpInst::Predicate::ICMP_SLE;
break;
case ICmpInst::Predicate::ICMP_SLT:
// x & (-1 >> y) s< x -> x s> (-1 >> y)
if (X != I.getOperand(1)) // X must be on RHS of comparison!
return nullptr; // Ignore the other case.
+ if (!match(M, m_Constant())) // Can not do this fold with non-constant.
+ return nullptr;
+ if (!match(M, m_NonNegative())) // Must not have any -1 vector elements.
+ return nullptr;
DstPred = ICmpInst::Predicate::ICMP_SGT;
break;
case ICmpInst::Predicate::ICMP_SLE: