[PATCH] D125717: [InstCombine] Optimize and of icmps with power-of-2 and contiguous masks
John McIver via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 17 00:00:20 PDT 2022
jmciver created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
jmciver added a comment.
jmciver updated this revision to Diff 429934.
jmciver published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
All six reported failing tests (due to timeouts) are passing locally in my build/test environment.
jmciver added a comment.
Fix capitzalation of function names containing ICMP
jmciver added a comment.
Based on functionality of the optimization I believe `foldLogOpOfMaskedICmps` to be a reasonable location. However, it maybe better to create a new function and call it from `InstCombinerImpl::foldAndOrOfICmps` based on the following.
The placement of the call to `foldLogOpOfMaskedICmps_AllZeros_BMask_NotMixed_and_NotAllOnes` in the function `foldLogOpOfMaskedICmps` breaks the consistency of the conditional testing based on the conjunction of left and right mask (see variable `Mask` line 586). It is possible to place calls to `foldLogOpOfMaskedICmps_AllZeros_BMask_NotMixed_and_NotAllOnes` in two locations in `foldLogOpOfMaskedICmps`:
- In function `foldLogOpOfMaskedIcmpsAsymmetric` called from conditional block `Mask == 0` (line 593)
- In conditional block `Mask & (Mask_NotAllZeros | BMask_NotAllOnes` (line 655)
I opted against this due to readability.
Thanks in advance for any feedback!
Add an instance combine optimization for expressions of the form:
(%arg u< C1 <https://reviews.llvm.org/C1>) & ((%arg & C2) != C2) -> %arg u< C2
Where C1 <https://reviews.llvm.org/C1> is a power-of-2 and C2 is a contiguous mask starting 1 bit below C1 <https://reviews.llvm.org/C1>.
This commit resolves GitHub missed-optimization issue #54856.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125717
Files:
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/icmp-logical.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125717.429934.patch
Type: text/x-patch
Size: 16853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220517/c721e234/attachment-0001.bin>
More information about the llvm-commits
mailing list