[PATCH] D142708: [NFC] Transition GlobalObject alignment from MaybeAlign to Align

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 07:51:07 PST 2023


gchatelet added a comment.

In D142708#4085604 <https://reviews.llvm.org/D142708#4085604>, @nikic wrote:

> @gchatelet I believe you'll want to use the preferred type alignment. Looking at https://github.com/llvm/llvm-project/blob/72121a20cda4dc91d0ef5548f93046e71c5ec6f6/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp#L324, we will currently pick the preferred type alignment as the default.

Thx for the suggestion @nikic!
If I manually apply dead code elimination to the code you're referring to with `GV` being a `Function` and `GV->getAlign()` returning `std::nullopt` I have the following code

  Align AsmPrinter::getGVAlignment(const GlobalObject *GV, const DataLayout &DL, Align InAlign = Align(1)) {
    Align Alignment;
    if (InAlign > Alignment)
      Alignment = InAlign;
    return Alignment;
  }

Which is basically `std::max(InAlign, Align(1))` or simply `Align(1)` as I don't see an obvious value for `InAlign` other than `1`.

So `1` it is?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142708



More information about the llvm-commits mailing list