[PATCH] D152843: Switch magic numbers to library functions in fixup
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 17:10:00 PDT 2023
MaskRay added inline comments.
================
Comment at: llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp:175
Ctx.reportError(Fixup.getLoc(), "fixup value out of range");
- if (Value & 0x3)
+ if (Value != alignTo<4>(Value))
Ctx.reportError(Fixup.getLoc(), "fixup not sufficiently aligned");
----------------
peter.smith wrote:
> While I think they will give the same result as this is a no-op for an already 4-byte aligned quantity it is a more extensive calculation as alignTo aligns to the next 4-byte boundary.
>
> Would isAligned(Value, 4) in Support/Alignment.h be better?
>
>
>
For this case, the original `Value & 0x3` seems clearer to me than the new `!isAligned(Align{4}, Value)`
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