[lld] [lld][LoongArch] Clean up CALL30 relocation with setK16 and checkInt (PR #176311)

Lu Weining via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 15 22:01:38 PST 2026


================
@@ -651,17 +647,15 @@ void LoongArch::relocate(uint8_t *loc, const Relocation &rel,
     // This relocation is designed for adjacent pcaddu12i+jirl pairs that
     // are patched in one time.
     // The relocation range is [-2G, +2G) (of course must be 4-byte aligned).
-    if ((int64_t)val != llvm::SignExtend64(val, 32))
-      reportRangeError(ctx, loc, rel, Twine(val), llvm::minIntN(32),
-                       llvm::maxIntN(32));
+    checkInt(ctx, loc, val, 32, rel);
     checkAlignment(ctx, loc, val, 4, rel);
     // Although jirl adds the immediate as a signed value, it is always positive
     // in this case, so no adjustment is needed, unlink CALL36.
----------------
SixWeining wrote:

```suggestion
    // in this case, so no adjustment is needed, unlike CALL36.
```

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


More information about the llvm-commits mailing list