[PATCH] D121392: [BOLT] Set cold sections alignment explicitly

Rafael Auler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 04:34:59 PDT 2022


rafauler added inline comments.


================
Comment at: bolt/lib/Passes/LongJmp.cpp:301
       continue;
     DotAddress = alignTo(DotAddress, BinaryFunction::MinAlign);
     uint64_t Pad =
----------------
>From what I understand, the real problem though is here, right?

We align with the minimum value, but we could be aligning more aggressively depending on "max align bytes", correct?

Also, this is done for every function. So if there is an alignment difference created from MinAlign vs. real alignment, I imagine this difference will increase as we emit more and more functions? What confused me then is why are we aligning only the very first function (via section alignment, since all functions are emitted to the same section). Wouldn't be better to replicate the logic to compute the correct alignment here? (Use a formula that retrieves how many bytes need to align and check it against max align bytes).  The goal of LongJmp is to replicate exactly what binary emitter is doing (I know this is unfortunate and bug prone, but I don't think there is a better way to have access to the exact offsets of the future layout of functions without calling the assembler and emitting everything)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121392



More information about the llvm-commits mailing list