[Bug target/88483] Unnecessary stack alignment

2021-08-15 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88483

--- Comment #7 from H.J. Lu  ---
*** Bug 88496 has been marked as a duplicate of this bug. ***

[Bug target/88483] Unnecessary stack alignment

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

H.J. Lu  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

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

[Bug target/88483] Unnecessary stack alignment

2019-05-22 Thread hjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88483

--- Comment #5 from hjl at gcc dot gnu.org  ---
Author: hjl
Date: Wed May 22 18:53:37 2019
New Revision: 271517

URL: https://gcc.gnu.org/viewcvs?rev=271517=gcc=rev
Log:
x86: Don't allocate stack frame nor align stack if not needed

get_frame_size () returns used stack slots during compilation, which
may be optimized out later.  This patch does the followings:

1. Add stack_frame_required to machine_function to indicate that the
function needs a stack frame.
2. Change ix86_find_max_used_stack_alignment to set stack_frame_required.
3. Always call ix86_find_max_used_stack_alignment to check if stack
frame is needed.

Tested on i686 and x86-64 with

--with-arch=native --with-cpu=native

Tested on AVX512 machine configured with

--with-arch=native --with-cpu=native

gcc/

PR target/88483
* config/i386/i386-options.c (ix86_init_machine_status): Set
stack_frame_required to true.
* config/i386/i386.c (ix86_get_frame_size): New function.
(ix86_frame_pointer_required): Replace get_frame_size with
ix86_get_frame_size.
(ix86_compute_frame_layout): Likewise.
(ix86_find_max_used_stack_alignment): Changed to void.  Set
stack_frame_required.
(ix86_finalize_stack_frame_flags): Always call
ix86_find_max_used_stack_alignment.  Replace get_frame_size with
ix86_get_frame_size.
* config/i386/i386.h (machine_function): Add stack_frame_required.

gcc/testsuite/

PR target/88483
* gcc.target/i386/stackalign/pr88483-1.c: New test.
* gcc.target/i386/stackalign/pr88483-2.c: Likewise.

Added:
trunk/gcc/testsuite/gcc.target/i386/stackalign/pr88483-1.c
trunk/gcc/testsuite/gcc.target/i386/stackalign/pr88483-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386-options.c
trunk/gcc/config/i386/i386.c
trunk/gcc/config/i386/i386.h
trunk/gcc/testsuite/ChangeLog

[Bug target/88483] Unnecessary stack alignment

2018-12-16 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88483

H.J. Lu  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
   Last reconfirmed||2018-12-16
 Resolution|FIXED   |---
   Target Milestone|9.0 |10.0
 Ever confirmed|0   |1

--- Comment #4 from H.J. Lu  ---
Revisit it in GCC 10.

[Bug target/88483] Unnecessary stack alignment

2018-12-16 Thread hjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88483

--- Comment #3 from hjl at gcc dot gnu.org  ---
Author: hjl
Date: Sun Dec 16 13:55:18 2018
New Revision: 267186

URL: https://gcc.gnu.org/viewcvs?rev=267186=gcc=rev
Log:
x86: Revert reversion 267133

Revert commit:

commit 76c21b271247ccbd681bdb4530426d2fe35dbfa5
Author: hjl 
Date:   Fri Dec 14 12:38:04 2018 +

x86: Don't use get_frame_size when finalizing stack frame

gcc/

PR target/88483
* config/i386/i386.c (ix86_finalize_stack_frame_flags): Revert
reversion 267133.

gcc/testsuite/

PR target/88483
* gcc.target/i386/stackalign/pr88483.c: Removed.  Revert
reversion 267133.

Removed:
trunk/gcc/testsuite/gcc.target/i386/stackalign/pr88483.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/testsuite/ChangeLog

[Bug target/88483] Unnecessary stack alignment

2018-12-14 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88483

H.J. Lu  changed:

   What|Removed |Added

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

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

[Bug target/88483] Unnecessary stack alignment

2018-12-14 Thread hjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88483

--- Comment #1 from hjl at gcc dot gnu.org  ---
Author: hjl
Date: Fri Dec 14 12:38:04 2018
New Revision: 267133

URL: https://gcc.gnu.org/viewcvs?rev=267133=gcc=rev
Log:
x86: Don't use get_frame_size when finalizing stack frame

get_frame_size () returns used stack slots during compilation, which
may be optimized out later.  Since ix86_find_max_used_stack_alignment
is called by ix86_finalize_stack_frame_flags to check if stack frame
is required, there is no need to call get_frame_size () which may give
inaccurate final stack frame size.

Tested on AVX512 machine configured with

--with-arch=native --with-cpu=native

gcc/

PR target/88483
* config/i386/i386.c (ix86_finalize_stack_frame_flags): Don't
use get_frame_size ().

gcc/testsuite/

PR target/88483
* gcc.target/i386/stackalign/pr88483.c: New test.

Added:
trunk/gcc/testsuite/gcc.target/i386/stackalign/pr88483.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/testsuite/ChangeLog