[DAGCombiner] `combineShuffleOfSplatVal()`: try to canonicalize to a splat shuffle
authorRoman Lebedev <lebedev.ri@gmail.com>
Sun, 15 Jan 2023 17:20:44 +0000 (20:20 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sun, 15 Jan 2023 18:11:33 +0000 (21:11 +0300)
commitf8d9097168b73e3befd94ac4e16cbc5f944afcec
treed9a5b463953f17d64876cc008e80157d8a3cb1d2
parent597001515a240ac4c3285f4a90f453394b5fad32
[DAGCombiner] `combineShuffleOfSplatVal()`: try to canonicalize to a splat shuffle

As noted in https://reviews.llvm.org/D141778#inline-1369900,
we fail to produce splat shuffles from certain sequences
of shuffles, that may have non-shuffles in the middle of seq.

There is a big pitfail to avoid here: just because `isSplatValue()`
says that all demanded elements are splat, we can't pick any random
one of them, because some of them could be undef! We must ignore those!
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/PowerPC/v4i32_scalar_to_vector_shuffle.ll
llvm/test/CodeGen/X86/srem-seteq-vec-nonsplat.ll
llvm/test/CodeGen/X86/urem-seteq-illegal-types.ll
llvm/test/CodeGen/X86/urem-seteq-vec-nonsplat.ll
llvm/test/CodeGen/X86/vec_smulo.ll
llvm/test/CodeGen/X86/vec_umulo.ll