diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2018-07-14 12:20:06 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2018-07-14 12:20:06 +0000 |
commit | fac48474ce2247a4c35da010866a07f3529337fa (patch) | |
tree | 7db93a4fa018a67e592d023e95e20ab77fea95ba /llvm/lib | |
parent | 3591eb9296f5ca7f53d564c6fdc02540a7299ad5 (diff) | |
download | bcm5719-llvm-fac48474ce2247a4c35da010866a07f3529337fa.tar.gz bcm5719-llvm-fac48474ce2247a4c35da010866a07f3529337fa.zip |
[InstCombine] Fold x & (-1 >> y) u>= x to x u<= (-1 >> y)
https://bugs.llvm.org/show_bug.cgi?id=38123
https://rise4fun.com/Alive/azI
This pattern is not commutative. But InstSimplify will
already have taken care of the 'commutative' variant.
llvm-svn: 337096
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 8601a29a7b1..f89dca42a55 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2892,6 +2892,11 @@ static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I, // x & (-1 >> y) != x -> x u> (-1 >> y) DstPred = ICmpInst::Predicate::ICMP_UGT; break; + case ICmpInst::Predicate::ICMP_UGE: + // x & (-1 >> y) u>= x -> x u<= (-1 >> y) + assert(X == I.getOperand(1) && "instsimplify took care of commut. variant"); + DstPred = ICmpInst::Predicate::ICMP_ULE; + break; // TODO: more folds are possible, https://bugs.llvm.org/show_bug.cgi?id=38123 default: return nullptr; |