[PATCH] D136742: [llvm][LoongArch] Improve the "out of range" error information reported by `adjustFixupValue`

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 19:02:45 PDT 2022


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp:82
+                                  MCContext &Ctx) {
+  int64_t min = -(INT64_C(1) << (N - 1));
+  uint64_t max = (INT64_C(1) << (N - 1)) - 1;
----------------
Remove the two variables. Use `llvm::minIntN(N)` and `llvm::maxIntN(N)` in `Twine.




================
Comment at: llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp:85
+  Ctx.reportError(Fixup.getLoc(), "fixup value out of range [" +
+                                      Twine(min).str() + ", " +
+                                      Twine(max).str() + "]");
----------------
Remove `.str()`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136742/new/

https://reviews.llvm.org/D136742



More information about the llvm-commits mailing list