diff options
| author | Roman Lebedev <lebedev.ri@gmail.com> | 2018-07-12 14:56:12 +0000 |
|---|---|---|
| committer | Roman Lebedev <lebedev.ri@gmail.com> | 2018-07-12 14:56:12 +0000 |
| commit | 74f899f0f42416fe44233820ea464776a3784a28 (patch) | |
| tree | 51a53b9eb78907f26ae4e608b1a3bf209ac762f9 /llvm/lib/Transforms | |
| parent | 0fbeae7a2efb301d790f116f78893841a8b40259 (diff) | |
| download | bcm5719-llvm-74f899f0f42416fe44233820ea464776a3784a28.tar.gz bcm5719-llvm-74f899f0f42416fe44233820ea464776a3784a28.zip | |
[InstCombine] Fold x & (-1 >> y) != x to x u> (-1 >> y)
Summary:
A complementary fold to D49179.
https://bugs.llvm.org/show_bug.cgi?id=38123
https://rise4fun.com/Alive/Rny
Caveat: one more thing in `test/Transforms/InstCombine/icmp-logical.ll` breaks.
Reviewers: spatel, craig.topper
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49205
llvm-svn: 336911
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index f3cc81d237e..8601a29a7b1 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2888,6 +2888,10 @@ static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I, // x & (-1 >> y) == x -> x u<= (-1 >> y) DstPred = ICmpInst::Predicate::ICMP_ULE; break; + case ICmpInst::Predicate::ICMP_NE: + // x & (-1 >> y) != x -> x u> (-1 >> y) + DstPred = ICmpInst::Predicate::ICMP_UGT; + break; // TODO: more folds are possible, https://bugs.llvm.org/show_bug.cgi?id=38123 default: return nullptr; |

