This patch improves instruction selection for i32 range check patterns like INT_MIN <= x && x <= INT_MAX and its alternatives.
On rv32: GCC: https://godbolt.org/z/1zKjfMqax Alive2: https://alive2.llvm.org/ce/z/FPc4ss
On rv64: GCC: https://godbolt.org/z/ezTsv8cEo Alive2: https://alive2.llvm.org/ce/z/ZkF7Er
I am unsure whether it is suitable to do the pattern match in ISel. I also have an alternative that does pattern match in RISCVCodeGenPrepare.