[RISCV] Check the types are the same for folding (sub 0, (setcc x, 0, setlt)) to (sra x, xlen - 1) (#158179)
We should check the type of x is the same as `sub` operation. Otherwise
the shift amount xlen -1 will exceed the bit size of x.
Fixes https://github.com/llvm/llvm-project/issues/158121.