[PATCH] D62024: [InstCombine] fold shuffles of insert_subvectors

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 14:34:37 PDT 2019


efriedma added a comment.

In terms of describing it, what is the backend actually going to see?

If both the source and destination types are legal, the rule is a sort of a "truncated shuffle rule"; essentially, given vectors with the same element type, the shuffle mask `<x,y,z,w>` should have roughly the same cost as the shuffle mask `<x,y,z,w,undef,undef,undef,undef>`.  (This isn't a great description because it sort of implies that the mask constants would be the same, but you get the idea.)  This is probably reasonable to expect on most targets that support multiple vector widths, but it does require some implementation work.  IIRC I did some optimization work related to this for AArch64.

If the destination type is legal, and the source type would be "widened" (in vector legalization terms) to the destination type, then effectively the two shuffles are the same, and the backend doesn't really need to be aware, I think.

If the destination type is legal, and the source type would be "promoted" (in vector legalization terms) to the destination type, then I'm not sure what rule would allow the transform: the shuffles aren't really related in any obvious way.

I won't try to enumerate the various cases where the destination type is illegal; I'm guessing it generally breaks down to one of the above cases somehow.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62024/new/

https://reviews.llvm.org/D62024





More information about the llvm-commits mailing list