diff options
Diffstat (limited to 'gcc/config/i386/i386.c')
-rw-r--r-- | gcc/config/i386/i386.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 605135fcf1c..5e96c7a0983 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8920,7 +8920,13 @@ ix86_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, /* For pointers passed in memory we expect bounds passed in Bounds Table. */ if (!nregs) - cum->bnds_in_bt = chkp_type_bounds_count (type); + { + /* Track if there are outgoing arguments on stack. */ + if (cum->caller) + cfun->machine->outgoing_args_on_stack = true; + + cum->bnds_in_bt = chkp_type_bounds_count (type); + } } /* Define where to put the arguments to a function. @@ -9218,6 +9224,10 @@ ix86_function_arg (cumulative_args_t cum_v, machine_mode omode, else arg = function_arg_32 (cum, mode, omode, type, bytes, words); + /* Track if there are outgoing arguments on stack. */ + if (arg == NULL_RTX && cum->caller) + cfun->machine->outgoing_args_on_stack = true; + return arg; } @@ -12096,7 +12106,11 @@ ix86_update_stack_boundary (void) static rtx ix86_get_drap_rtx (void) { - if (ix86_force_drap || !ACCUMULATE_OUTGOING_ARGS) + /* We must use DRAP if there are outgoing arguments on stack and + ACCUMULATE_OUTGOING_ARGS is false. */ + if (ix86_force_drap + || (cfun->machine->outgoing_args_on_stack + && !ACCUMULATE_OUTGOING_ARGS)) crtl->need_drap = true; if (stack_realign_drap) |