Questions about type based "createBuildVecShuffle()" in DAG Combiner

In LLVM DAG Combiner, DAGCombiner::createBuildVecShuffle() is type based.

DAGCombiner.cpp,

│17184 // We can’t generate a shuffle node with mismatched input and output types.

│17185 // Try to make the types match the type of the output.

When shufflevector was first introduced to IR and SelectionDAG, it required the output and input types to be identical. The IR shufflevector was later extended to allow arbitrary output types, but the SelectionDAG SHUFFLE_VECTOR was never changed.

This has generally worked out okay for most uses because size-changing shuffles are rare, and a lot of the interesting size-changing shuffles can be expressed in terms of CONCAT_VECTORS or EXTRACT_SUBVECTOR. But maybe it’s worth revisiting shuffle representations at the SelectionDAG level.

-Eli