diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2018-07-14 16:44:43 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2018-07-14 16:44:43 +0000 |
commit | 74f611a1f53c55d413ff252e8d7f2a502eb74a31 (patch) | |
tree | 9efe17bce8fb5380eb66a6fe3b93c99262dc79e6 /llvm/lib | |
parent | 60ea5df7c2a58bc777efbafc45997e2d00474e79 (diff) | |
download | bcm5719-llvm-74f611a1f53c55d413ff252e8d7f2a502eb74a31.tar.gz bcm5719-llvm-74f611a1f53c55d413ff252e8d7f2a502eb74a31.zip |
[InstCombine] Fold x u> x & C to x u> C
https://bugs.llvm.org/show_bug.cgi?id=38123
https://rise4fun.com/Alive/JvS
This pattern is not commutative. But InstSimplify will
already have taken care of the 'commutative' variant.
llvm-svn: 337100
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 eec8fadedb2..1024cbafaaa 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_UGT: + // x u> x & (-1 >> y) -> x u> (-1 >> y) + assert(X == I.getOperand(0) && "instsimplify took care of commut. variant"); + 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"); |