[PATCH] D77299: [InstCombine] convert bitcast-shuffle to vector trunc
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 05:56:12 PDT 2020
spatel created this revision.
spatel added reviewers: lebedev.ri, jeroen.dobbelaere, efriedma, dsprenkels.
Herald added subscribers: hiraditya, mcrosier.
As discussed in D76983 <https://reviews.llvm.org/D76983>, that patch can turn a chain of insert/extract with scalar trunc ops into bitcast+extract and existing instcombine vector transforms end up creating a shuffle out of that (see the PhaseOrdering test for an example). Currently, that process requires at least this sequence: -instcombine -early-cse -instcombine.
Before D76983 <https://reviews.llvm.org/D76983>, the sequence of insert/extract would reach the SLP vectorizer and become a vector trunc there.
Based on a small sampling of public targets/types, converting the shuffle to a trunc is better for codegen in most cases (and a regression of that form is the reason this was noticed). The trunc is clearly better for IR-level analysis as well.
This means that we can induce "spontaneous vectorization" without invoking any explicit vectorizer passes (at least a vector cast op may be created out of scalar casts), but that seems to be the right choice given that we started with a chain of insert/extract, and the backend would expand back to that chain if a target does not support the op.
https://reviews.llvm.org/D77299
Files:
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/test/Transforms/InstCombine/shuffle-cast.ll
llvm/test/Transforms/PhaseOrdering/vector-trunc.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77299.254490.patch
Type: text/x-patch
Size: 9259 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200402/20fe145c/attachment-0001.bin>
More information about the llvm-commits
mailing list