[PATCH] D53037: [InstCombine] combine a shuffle and an extract subvector shuffle

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 5 13:53:15 PST 2019


spatel added a comment.

In D53037#1385763 <https://reviews.llvm.org/D53037#1385763>, @lebedev.ri wrote:

> In D53037#1385727 <https://reviews.llvm.org/D53037#1385727>, @efriedma wrote:
>
> > That case is specifically interesting because when it's split, each half is lowered to a different shuffle, and both shuffles are expensive.
> >
> > Obviously you could try to find that specific pattern in SelectionDAG on AArch64, but I'm not sure it makes sense to expect the backend to try; instcombine probably shouldn't be creating difficult-to-solve optimization puzzles.
>
>
> But can you be sure there won't ever be such a `shuffle` via some other means?
>  I don't know that much about AArch64, but this really sounds like something to be dealt with in the backend..


Yes, that's our default argument for IR canonicalization: if the source code was already in this form to begin with, then there must be some missing optimization already out there.
But we have a special restriction for shufflevector - we assume that masks are only ever created if they are easy for the target to digest. And the corollary is that we don't create all-new shuffle masks in target-independent passes. That means we're going to miss some optimizations in IR that would've fallen out from intermediate transforms, but I think we have to live with that. As discussed in the earlier comments, this patch is right at the edge of the mask restriction.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D53037





More information about the llvm-commits mailing list