i386: Also adjust stack frame for stack slot alignment
authorH.J. Lu <hongjiu.lu@intel.com>
Wed, 10 Jan 2018 15:37:49 +0000 (15:37 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Wed, 10 Jan 2018 15:37:49 +0000 (07:37 -0800)
commitcd3410cc7b57fe3745f0fe764f5c322e0265ea1a
treed9cd7bd70788dd6f5be507a805dca0f462a6563d
parent447fb74d97f0fecbfe363cda7760df231e9b4c27
i386: Also adjust stack frame for stack slot alignment

We should also adjust stack_realign_offset for the largest alignment of
stack slot actually used when stack realignment isn't needed.  This is
required to keep stack frame properly aligned to satisfy the largest
alignment of stack slots.

Tested on Linux/i686 and Linux/x86-64.

gcc/

PR target/83735
* config/i386/i386.c (ix86_compute_frame_layout): Always adjust
stack_realign_offset for the largest alignment of stack slot
actually used.
(ix86_find_max_used_stack_alignment): New function.
(ix86_finalize_stack_frame_flags): Use it.  Set
max_used_stack_alignment if we don't realign stack.
* config/i386/i386.h (machine_function): Add
max_used_stack_alignment.

gcc/testsuite/

PR target/83735
* gcc.target/i386/pr83735.c: New test.

From-SVN: r256436
gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr83735.c [new file with mode: 0644]