Fix PR 65177: diamonds are not valid execution threads for jump threading

Richard Biener richard.guenther@gmail.com
Fri Mar 27 08:53:00 GMT 2015


On Thu, Mar 26, 2015 at 4:50 PM, Jeff Law <law@redhat.com> wrote:
> On 03/25/2015 05:09 PM, Sebastian Pop wrote:
>>>
>>> Specifically, it seems to me that copy_bbs should be refactored into
>>> copy_bbs and copy_bbs_for_threading or somesuch.  Where those
>>> routines call into refactored common subroutines, but obviously
>>> handle wiring up the outgoing edges from the copied blocks
>>> differently.
>>>
>>
>> That would be a good cleanup: I don't like to arbitrarily redirect edges
>> in
>> copy_bbs just to redirect them back to their initial place in the caller.
>
> Exactly.
>
>>
>>> The goal would be to eliminate the overly complex block copy/CFG
>>> update scheme in tree-ssa-threadupdate.c as part of a larger project
>>> to convert to a backward threader that can run independently of DOM.
>>
>>
>> I have a start of a patch for that cleanup, it currently runs wild as it
>> would
>> replace the existing threadupdate code generator with a call to the new
>> duplicate_thread_path.  I think we should take smaller more manageable
>> steps to
>> ease the review and to not destabilize the jump-threader.  In particular I
>> think
>> we should have both code generators for a while and turn one on/off with
>> an option.
>
> I hadn't planned on supporting both with an option, I'd rather make the
> switch and not look back :-)   An option just adds maintenance burdens
> (supporting both approaches) and doesn't actually help the end users (though
> it would help us as developers).
>
> Regardless, probably the first step is a common API for the two path
> duplication approaches.

Yeah, and refactoring copy_bbs so that the actual edge duplication happens
in another function (thus we can have two of them).

Note we have way too many copy-XYZ APIs/workers on GIMPLE already.

I was also playing with the idea to support value-numbering the stmts
on-the-fly as we copy them and use this for cost estimation of copies
(ok, well - basically do the copy and then either throw it away again
or accept it).
I thought about applying this to loop unrolling, but obviously this also applies
to any block duplication we do during jump threading.

Richard.

> Jeff



More information about the Gcc-patches mailing list