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.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@271517 138bc75d-0d04-0410-961f-82ee72b054a4
7 files changed