(Cond & C) | (~bitcast(Cond) & D) --> bitcast (select Cond, (bc C), (bc D))
This is part of fixing:
https://llvm.org/PR34047
That report shows a case where a bitcast is sitting between the select condition candidate and its 'not' value due to current cast canonicalization rules.
There's a restriction that might be violated in existing matching, but I still need to investigate if that is possible -
Alive2 shows we can only do this transform safely when the bitcast is from narrow to wide vector elements:
https://alive2.llvm.org/ce/z/Hf66qh
I think we should check if A is Integer vector after A = peekThroughBitcast(A);
A might be %astype = bitcast <4 x float> %c to <4 x i32>
when you peek through A, A become <4 x float> %c which can't be handled with ComputeNumSignBits.