[Bug rtl-optimization/90765] preferred_stack_boundary is updated for callee

2019-06-14 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90765

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |10.0

--- Comment #2 from H.J. Lu  ---
Fixed for GCC 10.

[Bug rtl-optimization/90765] preferred_stack_boundary is updated for callee

2019-06-14 Thread hjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90765

--- Comment #1 from hjl at gcc dot gnu.org  ---
Author: hjl
Date: Fri Jun 14 16:24:56 2019
New Revision: 272296

URL: https://gcc.gnu.org/viewcvs?rev=272296=gcc=rev
Log:
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.

Added:
trunk/gcc/testsuite/gcc.target/i386/pr90765-1.c
trunk/gcc/testsuite/gcc.target/i386/pr90765-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/calls.c
trunk/gcc/function.c
trunk/gcc/testsuite/ChangeLog