PING^1 [PATCH] DWARF: Relax SUPPORTS_STACK_ALIGNMENT with !crtl->stack_realign_tried

Jason Merrill jason@redhat.com
Wed Aug 29 18:34:00 GMT 2018


On Wed, Aug 29, 2018 at 8:47 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Aug 8, 2018 at 6:32 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> Assert for SUPPORTS_STACK_ALIGNMENT was added for dynamic stack
>> alignment.  At the time, arg_pointer_rtx would only be eliminated
>> by either hard_frame_pointer_rtx or stack_pointer_rtx only when
>> dynamic stack alignment is supported.  With
>>
>> commit cd557ff63f388ad27c376d0a225e74d3594a6f9d
>> Author: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
>> Date:   Thu Aug 10 15:29:05 2017 +0000
>>
>>     i386: Don't use frame pointer without stack access
>>
>>     When there is no stack access, there is no need to use frame pointer
>>     even if -fno-omit-frame-pointer is used and caller's frame pointer is
>>     unchanged.
>>
>> this can happen when there is no dynamic stack alignment.  This patch
>> relaxes SUPPORTS_STACK_ALIGNMENT with !crtl->stack_realign_tried to
>> allow arg_pointer_rtx to be eliminated by either hard_frame_pointer_rtx
>> or stack_pointer_rtx when there is no dynamic stack alignment at all.
>>
>> gcc/
>>
>>         PR debug/86593
>>         * dwarf2out.c (based_loc_descr): Replace SUPPORTS_STACK_ALIGNMENT
>>         with (SUPPORTS_STACK_ALIGNMENT || !crtl->stack_realign_tried).
>>         (compute_frame_pointer_to_fb_displacement): Likewise.
>>
>> gcc/testsuite/
>>
>>         PR debug/86593
>>         * g++.dg/pr86593.C: New test.
>>
>
> PING:
>
> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00559.html

It looks like crtl->stack_realign_tried is only ever set if
SUPPORTS_STACK_ALIGNMENT, so (SUPPORTS_STACK_ALIGNMENT ||
!crtl->stack_realign_tried) is always true.

If you don't need to use the frame pointer, then frame_pointer_needed
should be false, so the assert should already allow elimination to the
stack pointer.  Are we trying to eliminate to the hard frame pointer
even though we've decided we don't need it?  Why?

Jason



More information about the Gcc-patches mailing list