[PATCH] i386: Always set cfun->machine->max_used_stack_alignment

H.J. Lu hjl.tools@gmail.com
Sun Aug 5 12:51:00 GMT 2018


On Sun, Aug 5, 2018 at 12:15 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>> OK, but please add a comment, so in the future we will still know the
>>> purpose of the magic number.
>>>
>>
>> Like this?
>>
>> H.J.
>> ---
>> cfun->machine->max_used_stack_alignment is used to decide how stack frame
>> should be aligned.  This is independent of any psABIs nor 32-bit vs 64-bit.
>> It is always safe to compute max_used_stack_alignment.  We compute it only
>> if 128-bit aligned load/store may be generated on misaligned stack slot
>> which will lead to segfault.
>>
>> gcc/
>>
>>         PR target/86386
>>         * config/i386/i386.c (ix86_finalize_stack_frame_flags): Set
>>         cfun->machine->max_used_stack_alignment if needed.
>>
>> gcc/testsuite/
>>
>>         PR target/86386
>>         * gcc.target/i386/pr86386.c: New file.
>
> OK, but please write the condition as ">= 128". The number 64 confused
> me; I was thinking that it has something to do with minimum alignment
> on 64bit target, while 128 clearly shows that alignment is related to
> SSE moves. With ">= 128", I think that code is clear enough that a
> long comment is not needed.
>
> Thanks, and sorry for the confusion,
> Uros.
>

This is what I checked in.  I kept the comment change.  I will backport it
to GCC 8 after a few days.

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-i386-Set-cfun-machine-max_used_stack_alignment-if-ne.patch
Type: text/x-patch
Size: 3020 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180805/88a33283/attachment.bin>


More information about the Gcc-patches mailing list