[PATCH] D52146: [InstCombine] foldICmpWithLowBitMaskedVal(): handle ~(-1 << y) mask
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 16 01:27:14 PDT 2018
lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, craig.topper, RKSimon.
Two folds are happening here:
1. https://rise4fun.com/Alive/oaFX
2. And then `foldICmpWithHighBitMask()` (https://reviews.llvm.org/D52001): https://rise4fun.com/Alive/wsP4
This change doesn't just add the handling for eq/ne predicates,
it actually builds upon the previous `foldICmpWithLowBitMaskedVal()` work,
so **all** the 16 fold variants* are immediately supported.
I'm indeed only testing these two predicates.
I do not feel like re-proving all 16 folds*, because they were already proven
for the general case of constant with all-ones in low bits. So as long as
the mask produces all-ones in low bits, i'm pretty sure the fold is valid.
But required, i can re-prove, let me know.
- eq/ult/ule/ugt/uge are commutative - 12 folds; slt/sle/sgt/sge are not commutative - 4 folds. 16 folds in total.
https://bugs.llvm.org/show_bug.cgi?id=38123
https://bugs.llvm.org/show_bug.cgi?id=38708
Repository:
rL LLVM
https://reviews.llvm.org/D52146
Files:
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/canonicalize-low-bit-mask-v2-and-icmp-eq-to-icmp-ule.ll
test/Transforms/InstCombine/canonicalize-low-bit-mask-v2-and-icmp-ne-to-icmp-ugt.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52146.165674.patch
Type: text/x-patch
Size: 17632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180916/63c47028/attachment.bin>
More information about the llvm-commits
mailing list