In D61918 i was looking at dropping it in DAGCombiner visitShiftByConstant(),
but as @craig.topper pointed out, it was copied from here.
That check claims that the transform is illegal otherwise.
That isn't true:
- For ISD::ADD, we only process ISD::SHL outer shift => sign bit does not matter https://rise4fun.com/Alive/K4A
- For ISD::AND, there is no restriction on constants: https://rise4fun.com/Alive/Wy3
- For ISD::OR, there is no restriction on constants: https://rise4fun.com/Alive/GOH
- For ISD::XOR, there is no restriction on constants: https://rise4fun.com/Alive/ml6
So, why is it there then?
As far as i can tell, it dates all the way back to original check-in rL7793.
I think we should just drop it.