combineShuffleOfScalars is very conservative about shuffled BUILD_VECTOsR that can be combined together.
I'd like to add one additional case - if both BUILD_VECTORs represent splats of the same scalar value but with different UNDEF elements, then we should create a single splat BUILD_VECTOR, sharing only the common UNDEF elements.
This comment can be updated.
Your change would allow duplicate non-constant values in the resulting build vector if shuffle operands are both splat of the same value.