Commit 4f472e63 by H.J. Lu Committed by H.J. Lu

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
parent f961ec70
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> 2018-12-14 Andrew Stubbs <ams@codesourcery.com>
* gcc/lra-int.h (lra_register_new_scratch_op): Add third parameter. * gcc/lra-int.h (lra_register_new_scratch_op): Add third parameter.
...@@ -12876,7 +12876,6 @@ ix86_finalize_stack_frame_flags (void) ...@@ -12876,7 +12876,6 @@ ix86_finalize_stack_frame_flags (void)
&& flag_exceptions && flag_exceptions
&& cfun->can_throw_non_call_exceptions) && cfun->can_throw_non_call_exceptions)
&& !ix86_frame_pointer_required () && !ix86_frame_pointer_required ()
&& get_frame_size () == 0
&& ix86_nsaved_sseregs () == 0 && ix86_nsaved_sseregs () == 0
&& ix86_varargs_gpr_size + ix86_varargs_fpr_size == 0) && ix86_varargs_gpr_size + ix86_varargs_fpr_size == 0)
{ {
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> 2018-12-14 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/max_size.adb: New test. * gnat.dg/max_size.adb: New test.
......
/* { 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" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment