i386: Don't use frame pointer without stack access
authorH.J. Lu <hongjiu.lu@intel.com>
Thu, 10 Aug 2017 15:29:05 +0000 (15:29 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Thu, 10 Aug 2017 15:29:05 +0000 (08:29 -0700)
commit8e941ae950ddce1745b4d6819a7131908dd7de24
tree2676fe73d98e3af6afa9d71fb86c96914dda7181
parent798f86281b19395a9f64bfd5def1c12952c4ba05
i386: Don't use frame pointer without stack access

When there is no stack access, there is no need to use frame pointer
even if -fno-omit-frame-pointer is used and caller's frame pointer is
unchanged.

gcc/

PR target/81736
* config/i386/i386.c (ix86_finalize_stack_realign_flags): Renamed
to ...
(ix86_finalize_stack_frame_flags): This.  Also clear
frame_pointer_needed if -fno-omit-frame-pointer is used without
stack access.
(ix86_expand_prologue): Replace ix86_finalize_stack_realign_flags
with ix86_finalize_stack_frame_flags.
(ix86_expand_epilogue): Likewise.
(ix86_expand_split_stack_prologue): Likewise.
* doc/invoke.texi: Add a note for -fno-omit-frame-pointer.

gcc/testsuite/

PR target/81736
* gcc.target/i386/pr81736-1.c: New test.
* gcc.target/i386/pr81736-2.c: Likewise.
* gcc.target/i386/pr81736-3.c: Likewise.
* gcc.target/i386/pr81736-4.c: Likewise.
* gcc.target/i386/pr81736-5.c: Likewise.
* gcc.target/i386/pr81736-6.c: Likewise.
* gcc.target/i386/pr81736-7.c: Likewise.

From-SVN: r251028
gcc/ChangeLog
gcc/config/i386/i386.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr81736-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr81736-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr81736-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr81736-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr81736-5.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr81736-6.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr81736-7.c [new file with mode: 0644]