[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 12:28:26 PDT 2020


sdesmalen added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp:142
+        // (Unspecified alignment on allocas will be going away soon.)
+        Align SpecifiedAlign = AI->getAlign() ? *AI->getAlign() : TyPrefAlign;
+
----------------
nit: `AI->getAlign().getValueOr(TyPrefAlign)`


================
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);
 
----------------
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?


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