Update preferred_stack_boundary only when expanding function call
authorH.J. Lu <hongjiu.lu@intel.com>
Fri, 14 Jun 2019 16:24:56 +0000 (16:24 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Fri, 14 Jun 2019 16:24:56 +0000 (09:24 -0700)
commit957ed7386177e7d5da6b2908ec576906b784c892
tree35f27a49da3ff03bcfef1dce5de62f8d966ed6d5
parent84d38abbc982db405cfe7a45ed53c64745da5511
Update preferred_stack_boundary only when expanding function call

locate_and_pad_parm is called when expanding function call from
initialize_argument_information and when generating function body
from assign_parm_find_entry_rtl:

  /* Remember if the outgoing parameter requires extra alignment on the
     calling function side.  */
  if (crtl->stack_alignment_needed < boundary)
    crtl->stack_alignment_needed = boundary;
  if (crtl->preferred_stack_boundary < boundary)
    crtl->preferred_stack_boundary = boundary;

stack_alignment_needed and preferred_stack_boundary should be updated
only when expanding function call, not when generating function body.

Add update_stack_alignment_for_call to update stack alignment when
outgoing parameter is passed in the stack.

gcc/

PR rtl-optimization/90765
* calls.c (update_stack_alignment_for_call): New function.
(expand_call): Call update_stack_alignment_for_call when
outgoing parameter is passed in the stack.
(emit_library_call_value_1): Likewise.
* function.c (locate_and_pad_parm): Don't update
stack_alignment_needed and preferred_stack_boundary.

gcc/testsuite/

PR rtl-optimization/90765
* gcc.target/i386/pr90765-1.c: New test.
* gcc.target/i386/pr90765-2.c: Likewise.

From-SVN: r272296
gcc/ChangeLog
gcc/calls.c
gcc/function.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr90765-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr90765-2.c [new file with mode: 0644]