[PATCH] D79532: [SelectionDAG] Don't promote the alignment of allocas beyond the stack alignment.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 7 13:35:43 PDT 2020
sdesmalen accepted this revision.
sdesmalen added a comment.
This revision is now accepted and ready to land.
LGTM!
================
Comment at: llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp:150
Align Alignment =
- max(MF->getDataLayout().getPrefTypeAlign(Ty), AI->getAlign());
+ std::max(std::min(TyPrefAlign, StackAlign), SpecifiedAlign);
----------------
efriedma wrote:
> sdesmalen wrote:
> > The LangRef says:
> > > On every specification that takes a <abi>:<pref>, specifying the <pref> alignment is optional. If omitted, the preceding : should be omitted too and <pref> will be equal to <abi>.
> >
> > Does this need an assert to ensure that the type's ABI alignment <= StackAlign?
> The use of the preferred alignment here is purely an optimization. If the IR specifies the alignment it wants, the datalayout rules aren't relevant.
>
> The alignment of the alloca could end up less than the ABI alignment, and that's fine; if the frontend needed an ABI-aligned alloca, it wouldn't have specified a lower alignment.
Okay I wasn't sure about that, thanks for clarifying.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79532/new/
https://reviews.llvm.org/D79532
More information about the llvm-commits
mailing list