[PATCH] D128093: [lld-macho] Initial support for Linker Optimization Hints
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 25 17:55:06 PDT 2022
thakis added a comment.
Other than that, looks excellent to me.
================
Comment at: lld/MachO/Arch/ARM64.cpp:232
+ int64_t delta = rel1->referentVA - rel1->relocVA;
+ if (delta >= 1024 * 1024 || delta <= -1024 * 1024)
+ return;
----------------
`-2**10..2**10-1` is the range of a two's complement 21-bit immediate, which matches the bit pattern in writeAdr(). (Good; just explaining this code to myself.) Shouldn't -1024*1024 be inclusive on the lower end though? (i.e. change `<=` to `<` (?))
Also, I think some short comment (`// adr has a 21-bit two's complement immediate`) would maybe be nice.
Very nit: Maybe `(1 << 20) is clearer than `1024 * 1024` here? But up to you.
================
Comment at: lld/MachO/Arch/ARM64.cpp:261
+ return;
+ if ((rel1->referentVA & ~4095ULL) != (rel2->referentVA & ~4095ULL))
+ return;
----------------
nit: I'd find `0xfff` (with `ULL` suffix as needed) clearer than 4095
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128093/new/
https://reviews.llvm.org/D128093
More information about the llvm-commits
mailing list