Ross Ridge wrote: > I'm currently using -fpreferred-stack-boundary without any trouble. > Your proposal would in fact generate code to align stack when it's not > necessary. This would change the behaviour of -fpreferred-stack-boundary, > hurting performance and that's unacceptable to me. This proposal values correctness at first place. So when compile can't make sure a function is only called from functions with the same or bigger preferred-stack-boundary, it will conservatively align the stack. One optimization is to set INCOMING = PREFERRED for local functions. Do you think it more acceptable?
>> Ok, if people are using this flag to change the alignment to something >> smaller than used by the standard ABI, then INCOMING should be >> MAX(STACK_BOUNDARY, PREFERRED_STACK_BOUNDARY). > > On x86-64, ABI_STACK_BOUNDARY is 16byte, but the Linux kernel may > want to use 8 byte for PREFERRED_STACK_BOUNDARY. INCOMING will > be MIN(STACK_BOUNDARY, PREFERRED_STACK_BOUNDARY) == 8 byte. > Using MAX(STACK_BOUNDARY, PREFERRED_STACK_BOUNDARY) also equals 8 in that > case and preserves the behaviour -fpreferred-stack-boundary in every case. I think HJ means MIN(ABI_STACK_BOUNDARY, PREFERRED_STACK_BOUNDARY). MAX(ABI, PREFERRED) == 16 in this case. Thanks - Joey