[llvm] r308950 - [AArch64] Reserve a 16 byte aligned amount of fixed stack for win64 varargs

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 09:26:18 PDT 2017


Merged to 5.0 in r309132.

On Mon, Jul 24, 2017 at 10:20 PM, Martin Storsjo via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: mstorsjo
> Date: Mon Jul 24 22:20:01 2017
> New Revision: 308950
>
> URL: http://llvm.org/viewvc/llvm-project?rev=308950&view=rev
> Log:
> [AArch64] Reserve a 16 byte aligned amount of fixed stack for win64 varargs
>
> Create a dummy 8 byte fixed object for the unused slot below the first
> stored vararg.
>
> Alternative ideas tested but skipped: One could try to align the whole
> fixed object to 16, but I haven't found how to add an offset to the stack
> frame used in LowerWin64_VASTART.
>
> If only the size of the fixed stack object size is padded but not the offset, via
> MFI.CreateFixedObject(alignTo(GPRSaveSize, 16), -(int)GPRSaveSize, false),
> PrologEpilogInserter crashes due to "Attempted to reset backwards range!".
>
> This fixes misconceptions about where registers are spilled, since
> AArch64FrameLowering.cpp assumes the offset from fixed objects is
> aligned to 16 bytes (and the Win64 case there already manually aligns
> the offset to 16 bytes).
>
> This fixes cases where local stack allocations could overwrite callee
> saved registers on the stack.
>
> Differential Revision: https://reviews.llvm.org/D35720
>
> Modified:
>     llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
>     llvm/trunk/test/CodeGen/AArch64/aarch64_win64cc_vararg.ll
>     llvm/trunk/test/CodeGen/AArch64/win64_vararg.ll


More information about the llvm-commits mailing list