[PATCH] D76727: [VectorCombine] transform bitcasted shuffle to narrower elements
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 24 12:54:32 PDT 2020
spatel created this revision.
spatel added reviewers: lebedev.ri, efriedma, RKSimon.
Herald added subscribers: hiraditya, mcrosier.
bitcast (shuf V, MaskC) --> shuf (bitcast V), MaskC'
We do not attempt this in InstCombine because we do not want to change types and create new shuffle ops that are potentially not lowered as well as the original code. Here, we can check the cost model to see if it is worthwhile.
I've aggressively enabled this transform even if the types are the same size and/or equal cost because moving the bitcast allows InstCombine to make further simplifications.
In the motivating cases from PR35454:
https://bugs.llvm.org/show_bug.cgi?id=35454
...this is enough to let instcombine and the backend eliminate the redundant shuffles, but we probably want to extend VectorCombine to handle the inverse pattern (shuffle-of-bitcast) to get that simplification directly in IR.
https://reviews.llvm.org/D76727
Files:
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
llvm/test/Transforms/VectorCombine/X86/shuffle.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76727.252408.patch
Type: text/x-patch
Size: 7333 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200324/e711e404/attachment.bin>
More information about the llvm-commits
mailing list