From: H.J. Lu Date: Fri, 14 Dec 2018 12:38:04 +0000 (+0000) Subject: x86: Don't use get_frame_size when finalizing stack frame X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f472e636f7e99c3bca2fb70bd5adc2bb07dad3d;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3d4a9e5f8ba..e5c226498ae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-12-14 H.J. Lu + + PR target/88483 + * config/i386/i386.c (ix86_finalize_stack_frame_flags): Don't + use get_frame_size (). + 2018-12-14 Andrew Stubbs * 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 caa701fe242..edc8f4f092e 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 4e0e910ebf1..fc5d5ad3da3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-14 H.J. Lu + + PR target/88483 + * gcc.target/i386/stackalign/pr88483.c: New test. + 2018-12-14 Eric Botcazou * 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 00000000000..5aec8fd4cf6 --- /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" } } */