[InstCombine] Make sure that LHS and RHS have the same type in
If they don't have the same type, the size of the constant
index would need to be adjusted (and this wouldn't be always
Alternatively we could try the analysis with the initial
RHS value, which would guarantee that the two sides have
the same type. However it is unlikely that in practice this
would pass our transformation requirements.
Fixes PR31808 (https://llvm.org/bugs/show_bug.cgi?id=31808).