[llvm] f46a515 - [LoongArch] Remove unreachable Value check in fixupLeb128 (#186297)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 15 18:17:01 PDT 2026
Author: wanglei
Date: 2026-03-16T09:16:55+08:00
New Revision: f46a5153850c1303d687233d4adf699b01041da8
URL: https://github.com/llvm/llvm-project/commit/f46a5153850c1303d687233d4adf699b01041da8
DIFF: https://github.com/llvm/llvm-project/commit/f46a5153850c1303d687233d4adf699b01041da8.diff
LOG: [LoongArch] Remove unreachable Value check in fixupLeb128 (#186297)
Value is guaranteed to be zero after the loop:
for (I = 0; Value; ++I, Value >>= 7)
Therefore the subsequent `if (Value)` condition is always false.
Remove the unreachable code. Reported by PVS-Studio.
Fixed: #170122
Added:
Modified:
llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
index 0696813040654..6a8869c5d708a 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
@@ -136,8 +136,6 @@ static void fixupLeb128(MCContext &Ctx, const MCFixup &Fixup, uint8_t *Data,
unsigned I;
for (I = 0; Value; ++I, Value >>= 7)
Data[I] |= uint8_t(Value & 0x7f);
- if (Value)
- Ctx.reportError(Fixup.getLoc(), "Invalid uleb128 value!");
}
void LoongArchAsmBackend::applyFixup(const MCFragment &F, const MCFixup &Fixup,
More information about the llvm-commits
mailing list