[PATCH] D152843: Switch magic numbers to library functions in fixup

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 14:59:20 PDT 2023


MaskRay added inline comments.


================
Comment at: llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp:202
       Ctx.reportError(Fixup.getLoc(), "fixup value out of range");
-    if (Value & 0x3)
+    if (!isAligned(Align{4}, Value))
       Ctx.reportError(Fixup.getLoc(), "fixup must be 4-byte aligned");
----------------
arsenm wrote:
> I'm mostly surprised by the parameter ordering of isAligned, I'd expect the alignment value to be the second argument
I am still of the opinion that `isAligned(Align{4}, Value))` is a very awkward way to test alignment. We don't do this in other places, and I don't think it's a good suggestion.

`isUInt` is fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152843



More information about the llvm-commits mailing list