[PATCH] D79532: [SelectionDAG] Don't promote the alignment of allocas beyond the stack alignment.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 7 13:02:11 PDT 2020
efriedma marked an inline comment as done.
efriedma added inline comments.
================
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);
----------------
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.
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