http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59501
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Jakub Jelinek from comment #3) > > I'm not saying that ix86_get_drap_rtx should be changed. > But perhaps: > /* If the only reason for frame_pointer_needed is that we conservatively > assumed stack realignment might be needed, but in the end nothing that > needed the stack alignment had been spilled, clear frame_pointer_needed > and say we don't need stack realignment. */ > if (stack_realign > && !crtl->need_drap > && frame_pointer_needed > && crtl->is_leaf > && flag_omit_frame_pointer > && crtl->sp_is_unchanging > && !ix86_current_function_calls_tls_descriptor > && !crtl->accesses_prior_frames > && !cfun->calls_alloca > && !crtl->calls_eh_return > && !(flag_stack_check && STACK_CHECK_MOVING_SP) > && !ix86_frame_pointer_required () > && get_frame_size () == 0 > && ix86_nsaved_sseregs () == 0 > && ix86_varargs_gpr_size + ix86_varargs_fpr_size == 0) > in ix86_finalize_stack_realign_flags could be tweaked, not to bail out > always if we have !crtl->need_drap, because then it will be set pretty much > for all leaf functions. I wonder if we can e.g. ask DF whether the drap reg > is live at entry, if it isn't live, supposedly we can clear crtl->need_drap > or ignore it > for this purpose? Also, I wonder even if we actually need the drap register > we can't for the leaf functions just avoid the dynamic realignment and > simply let the prologue set the drap reg to the right value. It sounds a good idea. BTW, I think we have very decent drap coverage in gcc testsuite, as long as both -m32 and -m64 are tested.