On 5/16/19 12:46 PM, Richard Biener wrote:
> On Thu, May 16, 2019 at 6:14 PM Jeff Law <l...@redhat.com> wrote:
>>
>> On 5/15/19 3:03 PM, Alexandre Oliva wrote:
>>> On May 15, 2019, Richard Biener <richard.guent...@gmail.com> wrote:
>>>
>>>> On Wed, May 15, 2019 at 10:20 AM Alexandre Oliva <aol...@redhat.com> wrote:
>>>>>
>>>>> Gimple jump threading does not duplicate forwarder blocks that might
>>>>> be present before or after the copied block.
>>>
>>>> Empty forwarder blocks I presume?
>>>
>>> Empty except for debug stmts and possibly a final conditional jump that,
>>> in the threading path, becomes unconditional.
>> Right.  The tree-ssa-threadupate code all pre-dates the SEME copier
>> which is a *much* better way to handle duplicating the region.
>>
>> Initially we allowed only one block with side effects in the jump
>> threading path.  That's all we really knew how to do correctly.  We
>> extended that to ignore forwarders at some point since they didn't need
>> to be copied -- you just need to know where the forwarder block will go.
>>
>> We later added the ability to copy a second block with side effects in
>> the jump threading path.
>>
>> But I'd really like to just remove tree-ssa-threadupate.c.  It's
>> horribly convoluted due to old requirements.  I'm confident we could use
>> the SEME copier to handle all the existing cases in a much simpler fashion.
> 
> Not sure if that's the best infrastructure to use (it cannot copy a path
> crossing a backedge).  tracer does the duplicating incrementally
> for example.  Technically the duplication isn't difficult but some
> simplification on the fly would be nice (like actually merging the
> blocks and propagating out PHIs and constants).
We don't need to worry about backedges in this code anymore.

And yes, some simplification would be helpful.  In fact using the SEME
copier actually helps with that because it requires a bit more structure.

THe biggest downside I see with moving to the SEME copier here would be
that when we have multiple incoming edges that thread to the same
outgoing edge, the current copier will create a single duplicate.  We'd
likely end up with multiple duplicates using the SEME copier.

Jeff

Reply via email to