This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] i386: More use reference of struct ix86_frame to avoid copy
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Martin Liška <mliska at suse dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Tue, 16 Jan 2018 11:59:05 -0800
- Subject: Re: [PATCH] i386: More use reference of struct ix86_frame to avoid copy
- Authentication-results: sourceware.org; auth=none
- References: <20180116114035.GA9373@gmail.com> <CAMe9rOohQjFoMxpNYbfWLHYwBWzpuL=B9nBQuw0D_-R+6wsxBQ@mail.gmail.com> <5ffe44bb-9be8-bc27-749c-fa64f9f3fcb4@suse.cz> <CAMe9rOpRvL8fZHjoEg9NLRUcVKUx=oAHTSkKH_qDuwchcf-DvQ@mail.gmail.com>
On Tue, Jan 16, 2018 at 8:09 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Jan 16, 2018 at 7:03 AM, Martin Liška <mliska@suse.cz> wrote:
>> On 01/16/2018 01:35 PM, H.J. Lu wrote:
>>> On Tue, Jan 16, 2018 at 3:40 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> This patch has been used with my Spectre backport for GCC 7 for many
>>>> weeks and has been checked into GCC 7 branch. Should I revert it on
>>>> GCC 7 branch or check it into trunk?
>>>
>>> Ada build failed with this on trunk:
>>>
>>> raised STORAGE_ERROR : stack overflow or erroneous memory access
>>> make[5]: *** [/export/gnu/import/git/sources/gcc/gcc/ada/Make-generated.in:45:
>>> ada/sinfo.h] Error 1
>>
>> Hello.
>>
>> I know that you've already reverted the change, but it's possible to replace
>> struct ix86_frame &frame = cfun->machine->frame;
>>
>> with:
>> struct ix86_frame *frame = &cfun->machine->frame;
>>
>> And replace usages with point access operator (->). That would also avoid copying.
>
> Won't it be equivalent to reference?
>
>> One another question. After you switched to references, isn't the behavior of function
>> ix86_expand_epilogue as it also contains write to frame struct like:
>>
>> 14799 /* Special care must be taken for the normal return case of a function
>> 14800 using eh_return: the eax and edx registers are marked as saved, but
>> 14801 not restored along this path. Adjust the save location to match. */
>> 14802 if (crtl->calls_eh_return && style != 2)
>> 14803 frame.reg_save_offset -= 2 * UNITS_PER_WORD;
>
> That could be the issue. I will double check it.
>
Revert the ix86_expand_epilogue change fixes the ada build. I opened:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83905
--
H.J.