[llvm] [VectorCombine] Fold ZExt/SExt (Shuffle (ZExt/SExt %src)) to ZExt/SExt (Shuffle %src). (PR #141109)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 5 08:13:40 PDT 2025
preames wrote:
> > ```
> > 2. All of your tests appear to use identity shuffles. Those can just be removed. Once that's done, we have two adjacent extends, which should already be handled? Either your tests need updated, or there's something off here?
> > ```
>
> I may be missing something, but the shuffles are needed to extract half the vector elements. In the current version, I create a new shuffle of the narrower vector type, which is trivially fold-able by instcombine for the test cases.
Ah, I'd missed these were length changing shuffles.
Another high level question for you. Could we phrase this as a generic shuffle placement canonicalization? If my memory serves, we generally push truncates early, and extends late in instcombine. What would you think of an analogous canonicalization for narrowing and widening shuffles? In this particular case, it would group the extends together, and then let generic extend combines merge them.
https://github.com/llvm/llvm-project/pull/141109
More information about the llvm-commits
mailing list