The motivation of this patch is reduce the number of unique ways we handle splats in the RISCV backend. Before this, we would expand the splat vector into a build_vector for generic IR, but for intrinsics we'd frequently end up emitting a splat_vector during lowering and rely on later legalization. This meant that depending on the exact test case you looked at, very similar splats could take divergent paths during ISEL.
This change includes effectively a revert of D120328. This transformation is not generally profitable as it looses the information about the AVL of the vector being inserted. The result of this is that splats which could be done at a narrow VL, are instead done at VLMAX. Given splats are generally scheduled close to their consuming instruction, this results in widespread regressions on RISCV if splat_vectors make it into dag combine. (i.e. we end up needing to toggle VL repeatedly)
If desired, I could move the removed code into a target DAG for aarch64, but before doing that, I was hoping someone would have an idea on how to solve the generic problem in a profitable way. :) I don't know quite enough about AArch64 to know what's needed there, so pointers in the right direction are appreciated.
Does this do anything? RISCVTargetLowering::LowerOperation returns SDValue() for SPLAT_VECTOR unless it has i1 type.