[PATCH] D125086: [VectorCombine] Attempt to fold select shuffles from reductions
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 6 03:08:36 PDT 2022
dmgreen created this revision.
dmgreen added reviewers: samtebbs, spatel, RKSimon, SjoerdMeijer, labrinea.
Herald added a subscriber: hiraditya.
Herald added a project: All.
dmgreen requested review of this revision.
Herald added a project: LLVM.
Given a commutative reduction leading from a shuffle, the order of the lanes on the shuffle are not important for the result. This means we can reorder the shuffle to something simpler, which it tries shuffling the first vector lanes first. This was D123494 <https://reviews.llvm.org/D123494>.
The new shuffle may not be profitable though, and if it is not we can try the folding of select shuffles from D123911 <https://reviews.llvm.org/D123911>. This, with some adjustment as the output lane ordering is now unimportant, can allow the final shuffle to simplify given the inputs to the patterns from D123911 <https://reviews.llvm.org/D123911>. Where as each transformation on their own are not profitable, to combination is.
We can only support a single shuffle when called from reductions, but we are able to sort the ReconstructMask, potentially allowing it to simplify to an identity or concat mask.
https://reviews.llvm.org/D125086
Files:
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
llvm/test/Transforms/VectorCombine/AArch64/select-shuffle.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125086.427353.patch
Type: text/x-patch
Size: 18063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220506/7cb39965/attachment.bin>
More information about the llvm-commits
mailing list