select Cond, (shuf_sel X, Y), X --> shuf_sel X, (select Cond, Y, X)
A select of a select-shuffle ("blend" in x86 lingo) can be reversed so that the select is done first.
This is a more limited version of what I was trying in D80658, but it enables existing demanded bits transforms to catch some of the motivating cases. The tricky bit in that seems to be that by moving the shuffle later, we can always guarantee that poison is correctly inhibited by the shuffle mask in the final value.
Alive2 checks for the basic tests:
http://volta.cs.utah.edu:8080/z/Qqd3RK
http://volta.cs.utah.edu:8080/z/S4wchM
http://volta.cs.utah.edu:8080/z/wf9zPL
http://volta.cs.utah.edu:8080/z/wJeEGk
The problem is that we call ShuffleVectorInst::isSelectMask() before we ensure that select and shuffle have common operand, so by now types of their ops might be non-matching, and shuffle is lenght-changing.