[llvm] [RISCV] Remove unnecessary if guard before calling SignExtend64<6> in decodeCLUIImmOperand. NFC (PR #133514)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 28 13:21:37 PDT 2025


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/133514

None

>From ccf110bb475bc1bd3de01a5f0692826180816488 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Fri, 28 Mar 2025 13:20:46 -0700
Subject: [PATCH] [RISCV] Remove unnecessary if guard before calling
 SignExtend64<6> in decodeCLUIImmOperand. NFC

---
 llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
index e2a98e8bbbf4e..28c0623776977 100644
--- a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
+++ b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
@@ -455,8 +455,7 @@ static DecodeStatus decodeCLUIImmOperand(MCInst &Inst, uint32_t Imm,
   assert(isUInt<6>(Imm) && "Invalid immediate");
   if (Imm == 0)
     return MCDisassembler::Fail;
-  if (Imm > 31)
-    Imm = (SignExtend64<6>(Imm) & 0xfffff);
+  Imm = SignExtend64<6>(Imm) & 0xfffff;
   Inst.addOperand(MCOperand::createImm(Imm));
   return MCDisassembler::Success;
 }



More information about the llvm-commits mailing list