diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2018-01-11 20:44:46 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2018-01-11 12:44:46 -0800 |
commit | c7a61831d6ecec501acf0da0a227bd954e1d8922 (patch) | |
tree | 5ad9cd96eee55b9a06e104696bd1e13e64b07498 /gcc/config/i386 | |
parent | 278e902c24fd2ccbfe7c1ac2b0c4ef62a55696fc (diff) | |
download | gcc-c7a61831d6ecec501acf0da0a227bd954e1d8922.zip gcc-c7a61831d6ecec501acf0da0a227bd954e1d8922.tar.gz gcc-c7a61831d6ecec501acf0da0a227bd954e1d8922.tar.bz2 |
i386: Align stack frame if argument is passed on stack
When a function call is removed, it may become a leaf function. But if
argument may be passed on stack, we need to align the stack frame when
there is no tail call.
Tested on Linux/i686 and Linux/x86-64.
gcc/
PR target/83330
* config/i386/i386.c (ix86_compute_frame_layout): Align stack
frame if argument is passed on stack.
gcc/testsuite/
PR target/83330
* gcc.target/i386/pr83330.c: New test.
From-SVN: r256555
Diffstat (limited to 'gcc/config/i386')
-rw-r--r-- | gcc/config/i386/i386.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5e17b69..d6ff096 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -11339,11 +11339,16 @@ ix86_compute_frame_layout (void) offset += frame->va_arg_size; } - /* Align start of frame for local function. */ + /* Align start of frame for local function. When a function call + is removed, it may become a leaf function. But if argument may + be passed on stack, we need to align the stack when there is no + tail call. */ if (m->call_ms2sysv || frame->va_arg_size != 0 || size != 0 || !crtl->is_leaf + || (!crtl->tail_call_emit + && cfun->machine->outgoing_args_on_stack) || cfun->calls_alloca || ix86_current_function_calls_tls_descriptor) offset = ROUND_UP (offset, stack_alignment_needed); |