If we have a select whose operands are two shufflevectors and we know the
non-selected elements are undef, replace the instruction with a
shufflevector from the source vectors of the shufflevectors.
Added test cases.
IMO DeMorgan's law makes this kind of condition more readable
if (!VecTy || !TrueSV || !FalseSV)
Why is it important that SI has only one use?
Since you never use any VectorType methods you can skip the cast<>s here.
If it's not a ConstantInt it could also be a ConstantExpr instead of an Undef. You probably want to bail out in that case.
Argument "SI" is now unused :)
if (!isa<UndefValue>(TrueV2) || !isa<UndefValue>(FalseV2))
Can we have a more positive test case? The mask generation code isn't entirely trivial, would be good to have it verified by a test.