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.
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.
The ISD::VECTOR_SHUFFLE opcode is defined to have the same input/output types. That design is baked into all shuffle handling in SelectionDAG. I don’t know the history of why it was designed that way, but it would be hard to change at this point.