This allows us to create a vector_shuffle out of a build_vector, when we have extract_elements from two inputs, at least one of which is wider than the output.
(E.g. a <8 x i16> being constructed out of elements from a <16 x i16> and a <8 x i16>).
This is the first patch in a series - the idea is to get all of the "oddshuffles" tests to use shuffles instead of insert/extract sequences. Most (all?) of the remaining cases require building a vector out of more than 2 inputs.
My understanding is that we check if VT is a legal type for the target at the very beginning of this method.
However, (correct me if I am wrong) we don't check if InVT1 and InVT2 are legal types. So, we potentially always enable this canonicalization even on illegal vector types.
I wonder if we should add a early exit for the case where the DAG is not "type legalized" and InVT1 and InVT2 are not legal types for the target. The legalizer would adjust/canonicalize those vector types. We would still end up running your code if eventually types still don't match VT.
Not sure if this makes sense.