Apply canonicalization rules:
- Input vectors with no elements selected from can be replaced with undef.
- If only one input vector is constant it shall be the second one.
This allows constant-folding to cover more ad-hoc simplifications that
were in place and avoid duplication for RHS and LHS checks.
There are more rules we may want to add in the future when we see a
justification. e.g. mask elements that select undef elements can be
replaced with undef.
I got confused by the order of the patches/dependencies. This patch is proposing to remove this check that would be added by D32293. That's because the code in this patch will tell us that MaskSelects0 && MaskSelects1 are false, and that will then fall into ConstantFoldShuffleVectorInstruction and get folded?
I would've just left this check here as an early exit for the easy case.
FWIW, this may just be a case of too many cooks in the kitchen. :)
I think the end result of these 2 patches covers everything that we want in the current set of regression tests.