On Fri, Jul 7, 2017 at 12:14 AM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Thu, Jul 6, 2017 at 12:08 PM, H.J. Lu <hongjiu...@intel.com> wrote: >> Since DRAP is needed only if there are outgoing arguments on stack, we >> should track outgoing arguments on stack and avoid setting need_drap to >> true when there are no outgoing arguments on stack. >> >> Tested on i686 and x86-64 with SSE2, AVX and AVX2. There is no >> regression. OK for trunk? >> >> H.J. >> --- >> gcc/ >> >> PR target/81313 >> * config/i386/i386.c (ix86_function_arg_advance): Set >> outgoing_args_on_stack to true if there are outgoing arguments >> on stack. >> (ix86_function_arg): Likewise. >> (ix86_get_drap_rtx): Use DRAP only if there are outgoing >> arguments on stack and ACCUMULATE_OUTGOING_ARGS is false. >> * config/i386/i386.h (machine_function): Add >> outgoing_args_on_stack. >> >> @@ -10473,6 +10479,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) >> + cfun->machine->outgoing_args_on_stack = true; > > This should be > > + /* Track if there are outgoing arguments on stack. */ > + if (arg == NULL_RTX && cum->caller) > + cfun->machine->outgoing_args_on_stack = true; > > to check outgoing arguments for caller here. > >> return arg; >> } >> >> > > I am testing updated patch with a new testcase.
Updated patch LGTM. OK for mainline. Thanks, Uros.