foldBitOpOfCastops currently just folds bitop(castop(x), castop(y)) -> castop(bitop(x, y))
But we often have operands that have already constant folded the castop away which prevents the fold from proceeding.
The most obvious are not patterns:
%x.cast = bitcast <4 x i32> %x to <2 x i64>
%not = xor <2 x i64>%x.cast, splat (i64 -1)
-->
%not.cast = <4 x i32> %x, splat (i32 -1)
%not = bitcast <4 x i32> %not.cast to <2 x i64>
Any other bitcasted constants would be easy to handle as well.
But other casts that can be easily inverted (truncations, in range sext/zext etc.) could be handled as well.