[llvm-branch-commits] [llvm] DAG: Avoid forming shufflevector from a single extract_vector_elt (PR #122672)
Philip Reames via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jan 14 09:23:37 PST 2025
preames wrote:
> > Isn't the condition in code in terms of VecIn.size() == 2? I believe that VecIn is the _unique_ input elements, right? Which is distinct from the number of elements in the destination type? (Am I just misreading? I only skimmed this.)
>
> VecIn is collecting only extract_vector_elts feeding the build_vector. So it's true it's not only a 2 element vector, in general (but the standard case of building a complete vector is 2 elements). The other skipped elements are all constant or undef.
>
> A 2 element shuffle just happens to the only case I care about which I'm trying to make legal (and really only the odd -> even case is of any use).
This is exactly the distinct I'm trying to get at. Avoiding the creation of a 1-2 element shuffle seems quite reasonable. Avoiding the creation of a 100 element splat shuffle does not. I think you need to add an explicit condition in terms of the number elements in the result, not the number of *unique* elements in the result.
https://github.com/llvm/llvm-project/pull/122672
More information about the llvm-branch-commits
mailing list