This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Do not emit unnecessary NOPs at -O0
- From: Jeff Law <law at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 22 Jun 2018 09:58:48 -0600
- Subject: Re: Do not emit unnecessary NOPs at -O0
- References: <1529603927.Q0ovV4Gg7X@polaris> <0c5a9232-8aa1-7403-dd42-5e97298fe142@redhat.com> <CAFiYyc0hJ6es6f+v+qrfuYMhj34g2hOY=qE-y-fX6EeiOOJ8oA@mail.gmail.com>
On 06/22/2018 02:39 AM, Richard Biener wrote:
> On Thu, Jun 21, 2018 at 9:37 PM Jeff Law <law@redhat.com> wrote:
>>
>> On 06/21/2018 11:04 AM, Eric Botcazou wrote:
>>> When code is compiled at -O0, the RTL middle-end makes sure that location
>>> information is preserved as much as possible by generating NOPs with the
>>> location information (goto_locus) present on edges in the CFG, if it thinks
>>> that these edges are the only place where a particular location is mentioned.
>>>
>>> The attached patch prevents this from happening in a couple of cases:
>>> 1. if the function has the DECL_IGNORED_P flag set,
>>> 2. if the NOP is emitted by merge_blocks and the 2nd block is a forwarder
>>> block whose outgoing edge has no location, because in this case the location
>>> of the to-be-elided edge is copied onto the aforementioned outgoing edge.
>>>
>>> Tested (GCC and GDB) on x86-64/Linux, applied on the mainline.
>>>
>>>
>>> 2018-06-21 Eric Botcazou <ebotcazou@adacore.com>
>>>
>>> * cfgrtl.c (fixup_reorder_chain): Do not emit NOPs in DECL_IGNORED_P
>>> functions.
>>> (rtl_merge_blocks): Likewise. Do not emit a NOP if the location of the
>>> edge can be forwarded.
>>> (cfg_layout_merge_blocks): Likewise.
>> Funny Alex and I were just talking about the need to stuff away debug
>> info on edges for gimple. Attaching it to gimple nops sounds like a
>> fairly straightforward approach :-)
>
> But wouldn't that create BBs? Sounds like you want DEBUG PHIs... :/
We talked about those too :-)
Jeff