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

Andrew Savonichev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 03:32:45 PDT 2022


asavonic added a comment.

In D135462#3843425 <https://reviews.llvm.org/D135462#3843425>, @efriedma wrote:

> 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>.)

Yes, this can cause some issues (as indicated by test changes), because alignment on alloca suddenly becomes more important. 
Unfortunately, I don't see any other way how we can support alignment that is lower than the preferred alignment.



================
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
----------------
efriedma wrote:
> 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.
Apparently all 3 allocas have preferred alignment of 4.

It sound like the test is supposed to verify the preferred alignment. If we keep explicit alignment, it will take precedence over the preferred alignment. 

So I suggest to have two tests: one where alignment is implicit, and another where alignment is set to whatever value we expect the preferred alignment to be.


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