[llvm] [RISCV][NFC] Simplify Imm range checks (PR #170497)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 3 17:16:38 PST 2025
================
@@ -2904,7 +2904,7 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
Ok = isUInt<5>(Imm) && (Imm > 3);
break;
case RISCVOp::OPERAND_UIMM5_PLUS1:
- Ok = (isUInt<5>(Imm) && (Imm != 0)) || (Imm == 32);
+ Ok = Imm >= 1 && Imm <= 32;
----------------
arichardson wrote:
Ah yes I guess you could cast to unsigned but that negates the clarity benefit.
https://github.com/llvm/llvm-project/pull/170497
More information about the llvm-commits
mailing list