r238503 fixed the problem of too-small shift types by promoting them during legalization, but failed to consider the case in which the shift type is too large. On an out of tree target, the shift type is i64 (because that's the pointer type, and pre-legalization, shifts are created with shift type == pointer type). But i64 isn't legal, so it tries to extend it and crashes.
This attempts to fix the problem by only performing the zext promotion if the shift-amount type is smaller than the result type; if it's both illegal and larger, we don't want to touch it at this point.