diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2018-12-14 12:38:04 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2018-12-14 04:38:04 -0800 |
commit | 4f472e636f7e99c3bca2fb70bd5adc2bb07dad3d (patch) | |
tree | 9cc66ec9c0f5de6f878eed0d32c22b2a5329a741 | |
parent | f961ec70ee07768f87e9e2ce2b3cac4160fd065e (diff) | |
download | gcc-4f472e636f7e99c3bca2fb70bd5adc2bb07dad3d.zip gcc-4f472e636f7e99c3bca2fb70bd5adc2bb07dad3d.tar.gz gcc-4f472e636f7e99c3bca2fb70bd5adc2bb07dad3d.tar.bz2 |
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.
From-SVN: r267133
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/stackalign/pr88483.c | 17 |
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3d4a9e5..e5c2264 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-12-14 H.J. Lu <hongjiu.lu@intel.com> + + PR target/88483 + * config/i386/i386.c (ix86_finalize_stack_frame_flags): Don't + use get_frame_size (). + 2018-12-14 Andrew Stubbs <ams@codesourcery.com> * gcc/lra-int.h (lra_register_new_scratch_op): Add third parameter. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index caa701f..edc8f4f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -12876,7 +12876,6 @@ ix86_finalize_stack_frame_flags (void) && flag_exceptions && cfun->can_throw_non_call_exceptions) && !ix86_frame_pointer_required () - && get_frame_size () == 0 && ix86_nsaved_sseregs () == 0 && ix86_varargs_gpr_size + ix86_varargs_fpr_size == 0) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e0e910..fc5d5ad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-14 H.J. Lu <hongjiu.lu@intel.com> + + PR target/88483 + * gcc.target/i386/stackalign/pr88483.c: New test. + 2018-12-14 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/max_size.adb: New test. diff --git a/gcc/testsuite/gcc.target/i386/stackalign/pr88483.c b/gcc/testsuite/gcc.target/i386/stackalign/pr88483.c new file mode 100644 index 0000000..5aec8fd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/stackalign/pr88483.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -mavx2" } */ + +struct B +{ + char a[12]; + int b; +}; + +struct B +f2 (void) +{ + struct B x = {}; + return x; +} + +/* { dg-final { scan-assembler-not "and\[lq\]?\[^\\n\]*-\[0-9\]+,\[^\\n\]*sp" } } */ |