[llvm] [RISCV][NFC] Simplify Imm range checks (PR #170497)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 3 10:38:13 PST 2025
================
@@ -2898,13 +2898,13 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
Ok = isShiftedUInt<4, 1>(Imm);
break;
case RISCVOp::OPERAND_UIMM5_NONZERO:
- Ok = isUInt<5>(Imm) && (Imm != 0);
+ Ok = Imm >= 1 && Imm <= 31;
----------------
arichardson wrote:
personally I also think that using isUInt<N> instead of "magic" constants is easier to read.
https://github.com/llvm/llvm-project/pull/170497
More information about the llvm-commits
mailing list