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

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 28 13:22:08 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Craig Topper (topperc)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/133514.diff


1 Files Affected:

- (modified) llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp (+1-2) 


``````````diff
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;
 }

``````````

</details>


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


More information about the llvm-commits mailing list