[PATCH] D31509: [InstCombine] Combine vector shuffles if the same operand can be reused

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 18:13:49 PDT 2017


efriedma added a comment.

> Or did you mean that we could do a better job with the three IR instruction form even though we currently don't?

I mean the obvious lowering for the three-shuffle form is better that what the backend can figure out on its own for the one-shuffle form.  Compare to gcc, which doesn't try to do anything clever.  Or compile the IR for another target, like ARM.

----

Trying to distinguish between shuffles which should be preserved and those which shouldn't using metadata is probably a dead end; we don't really trust the user to use the best possible shuffles.

Maybe we could record the original shuffle when we combine a shuffle, as a hint to the backend if it can't figure out a good way to lower the combined shuffle?  That solves the problem, I guess, but it's a lot of work just to improve code generation for obscure shuffles.

Or maybe a target hook is the least-bad option.


https://reviews.llvm.org/D31509





More information about the llvm-commits mailing list