[LLVMdev] Stack alignment on X86 AVX seems incorrect

Jim Grosbach grosbach at apple.com
Thu Mar 1 15:25:06 PST 2012


On Mar 1, 2012, at 3:07 PM, Eric Christopher <echristo at apple.com> wrote:

> 
> On Mar 1, 2012, at 3:04 PM, Cameron McInally <cameron.mcinally at nyu.edu> wrote:
> 
>> On Thu, Mar 1, 2012 at 5:30 PM, Cameron McInally <cameron.mcinally at nyu.edu> wrote:
>> Aligning the stack to 32 bytes when there are auto AVX vector variables present shouldn't necessarily break the x86-64 ABI, as long as smaller auto variables remain properly aligned.  A similar approach was taken for i386 in GCC in order to support SSE vectors.
>> 
>> 
>> This topic is starting to come back to me now. The reason the GCC solution above did not work for us is that we do not build all of the libraries used with our compiler. For example, some are proprietary compiled object files and some are GCC compiled object files from other sources. If our object files called another library, and in turn that library called a function in our object code, it's not possible to ensure that the frame of the current function is still aligned to 32 bytes. That was the determining factor in my implementation.
> 
> You can only ever guarantee that code is aligned to the ABI alignment.

On entry to the function, right. The function can do dynamic stack realignment, however, to whatever it wants. ARM, especially on Darwin, does that quite a lot.

-Jim



More information about the llvm-dev mailing list