This can be viewed as recognizing that multiply-by-power-of-2 doesn't have a carry into the top bit of an M-bit * N-bit number.
Enhancing canonicalization of mul -> select might also handle some of these if we were ok with increasing instruction count with casts in some cases.
This doesn't help https://llvm.org/PR49055 , but it's a simpler pattern that we miss.
Note: "-sccp" already gets these examples using a constant range analysis.
You could generalize further in two ways:
Not sure either one is actually useful, though.