[llvm] f33245a - [AArch64] Fix a always true condition warning. NFC

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 1 07:56:08 PST 2024


Author: David Green
Date: 2024-01-01T15:56:03Z
New Revision: f33245a5c4411ce586efe2e12fc29aabb241f5e1

URL: https://github.com/llvm/llvm-project/commit/f33245a5c4411ce586efe2e12fc29aabb241f5e1
DIFF: https://github.com/llvm/llvm-project/commit/f33245a5c4411ce586efe2e12fc29aabb241f5e1.diff

LOG: [AArch64] Fix a always true condition warning. NFC

As ImmVal is unsigned, it will always be >= 0

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp b/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
index e3220d103ae0d3..a21b4b77166ede 100644
--- a/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
+++ b/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
@@ -896,7 +896,7 @@ static DecodeStatus DecodePCRelLabel16(MCInst &Inst, unsigned Imm,
   // Immediate is encoded as the top 16-bits of an unsigned 18-bit negative
   // PC-relative offset.
   uint64_t ImmVal = Imm;
-  if (ImmVal < 0 || ImmVal > (1 << 16))
+  if (ImmVal > (1 << 16))
     return Fail;
   ImmVal = -ImmVal;
   if (!Decoder->tryAddingSymbolicOperand(Inst, (ImmVal << 2), Addr,


        


More information about the llvm-commits mailing list