This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Try to update dominance info in tree-call-cdce.c
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, richard dot sandiford at arm dot com
- Date: Fri, 30 Oct 2015 13:36:54 +0100
- Subject: Re: Try to update dominance info in tree-call-cdce.c
- Authentication-results: sourceware.org; auth=none
- References: <87a8r0wqoe dot fsf at e105548-lin dot cambridge dot arm dot com> <CAFiYyc1483DY3Uq+zmkcfraLrwMCuxAsb_J5jv1jvWJizeNBnw at mail dot gmail dot com> <871tccwo2g dot fsf at e105548-lin dot cambridge dot arm dot com>
On Fri, Oct 30, 2015 at 1:14 PM, Richard Sandiford
<richard.sandiford@arm.com> wrote:
> Richard Biener <richard.guenther@gmail.com> writes:
>> On Fri, Oct 30, 2015 at 12:18 PM, Richard Sandiford
>> <richard.sandiford@arm.com> wrote:
>>> The pass would free the dominance info after making a change, but it
>>> should be pretty easy to keep the information up-to-date when the call
>>> has no EH edges. In a way the main hurdle was split_block, which seemed
>>> to assume that the new block would postdominate the old one, and that
>>> all blocks immediately dominated by the old block are now immediately
>>> dominated by the new one.
>>>
>>> Tested on x86_64-linux-gnu, arm-linux-gnueabi and aarch64-linux-gnu.
>>> OK to install?
>>
>> Hmm, I don't understand why split_block needs to be touched. The
>> operation itself correctly updates dominator info. It is up to the
>> pass to fix things up if it does further CFG modifications that make
>> the new block no longer post-dominate the old one.
>>
>> So why do you need the split_block change?
>
> The updates we'd need here would be:
>
> redirect_immediate_dominators (CDI_DOMINATORS, call, guard_bb);
>
> which undoes the earlier:
>
> redirect_immediate_dominators (CDI_DOMINATORS, guard_bb, call);
>
> that split_block did. It just seemed wasteful to call
> redirect_immediate_dominators twice to get a no-op.
>
> In other words, there are going to be callers to split_block that
> know the second block isn't going to postdominate the first and
> where the calling;
>
> redirect_immediate_dominators (CDI_DOMINATORS, first_block,
> second_block);
>
> is taking us further from where we want to be.
That's true. In an ideal world we'd have a CFG hook creating a
(half) diamond directly.
I wonder how other passes work around this issue? I suppose
they are splitting the block to form the conditonal block and the
joiner? If you have those and then only split the fallthru edge
between them the redundant work done is minimal.
Richard.
> Thanks,
> Richard
>