[PATCH] D24378: [CodeGen] Provide an appropriate alignment for dynamic allocas

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 9 11:28:32 PDT 2016


On Fri, Sep 9, 2016 at 10:45 AM, Friedman, Eli via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> It probably makes sense to say that alloca should have the same alignment
> as the default stack alignment, simply because it's hard to do anything
> useful with completely unaligned memory.  That said, the default stack
> alignment is 4 bytes on 32-bit Windows, not 16.
>

Well, if the allocated size is dynamic, it would seem preferable to provide
a pointer that's suitably-aligned for anything that can fit within it, and
even on 32-bit x86 that means 16 byte alignment if we want to support SSE.
But if the size is known, there doesn't seem to be any need to provide an
alignment greater than the allocated size.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160909/4a02f6ac/attachment.html>


More information about the cfe-commits mailing list