[LLVMdev] x86 Frame Pointer with AVX

Eric Christopher echristo at gmail.com
Tue Oct 23 09:56:53 PDT 2012

> Thanks for replying so quickly. Would you elaborate on this further?
> It seems costly to change the default stack alignment on the platform, since
> that would require recompiling all of the system and user libraries to also
> adhere to 32-byte stack alignment. Depending on an alignment not specified
> by the ABI would also limit our compiler's interoperability with other
> compilers installed on the system.
> I suppose that the stack could be aligned dynamically at main(...) and other
> visible entry points, but that too seems costly compared to the current
> M.O..
> Maybe I do not fully understand all the issues involved, but I suppose I
> should be able to dynamically align the stack only when AVX registers are
> spilled in a function, right? Seems reasonable with my limited knowledge. Do
> you have any intuition built? It could be possible that the
> prologue/epilogue emitters run prior to the spilling decisions. I am not so
> sure of the ordering here.
> Also, and this might be asking a lot, but do you have any insight into why
> this behaviour changed sometime around the LLVM 3.0 release? I have not been
> able to find much history.

It should only be happening if there is either a variable stored or
saved on the stack. Functions without AVX shouldn't cause a 32-byte
aligned stack or a realignment unless they are using callee saved
registers that are clobbered, etc. Basically any stack traffic with an
AVX register should cause a dynamic realignment and otherwise we
should use the default abi alignment. Arguably a bug if anything else
is happening.


More information about the llvm-dev mailing list