[PATCH] D135462: [SelectionDAG] Do not second-guess alignment for alloca

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 11:12:59 PDT 2022


efriedma added a comment.

Given we're de-emphasizing the type of allocas, this probably makes sense?  We should be careful that this doesn't have unexpected effects, though; decreasing the alignment of an alloca could affect code generation.  (For example, see D134282 <https://reviews.llvm.org/D134282>.)



================
Comment at: llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp:137
         // The "specified" alignment is the alignment written on the alloca,
         // or the preferred alignment of the type if none is specified.
+        Align Alignment = AI->getAlign();
----------------
Outdated comment?


================
Comment at: llvm/test/CodeGen/AArch64/preferred-alignment.ll:10
 ; CHECK-NEXT:	add	x1, sp, #8
-  %i = alloca i32, align 4
+  %i = alloca i32
 ; CHECK-NEXT:	add	x2, sp, #4
----------------
Please explicitly specify alignment where possible.

I though the preferred alignment of i8 is 1?  I can't see how this change has any practical effect.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135462



More information about the llvm-commits mailing list