fwprop fix for PR79405

Jeff Law law@redhat.com
Thu Feb 23 22:21:00 GMT 2017


On 02/23/2017 01:57 AM, Richard Biener wrote:
> On Wed, Feb 22, 2017 at 6:19 PM, Jeff Law <law@redhat.com> wrote:
>> On 02/16/2017 12:41 PM, Bernd Schmidt wrote:
>>>
>>> We have two registers being assigned to each other:
>>>
>>>  (set (reg 213) (reg 209))
>>>  (set (reg 209) (reg 213))
>>>
>>> These being the only definitions, we are happy to forward propagate reg
>>> 209 for reg 213 into a third insn, making a new use for reg 209. We are
>>> then happy to forward propagate reg 213 for it in the same insn...
>>> ending up in an infinite loop.
>>>
>>> I don't really see an elegant way to prevent this, so the following just
>>> tries to detect the situation (and more general ones) by brute force.
>>> Bootstrapped and tested on x86_64-linux, verified that the test passes
>>> with a ppc cross, ok?
>>>
>>>
>>> Bernd
>>>
>>>
>>> 79405.diff
>>>
>>>
>>>         PR rtl-optimization/79405
>>>         * fwprop.c (forward_propagate_into): Detect potentially cyclic
>>>         replacements and bail out for them.
>>>
>>>         PR rtl-optimization/79405
>>>         * gcc.dg/torture/pr79405.c: New test.
>>
>> OK.
>
> Err - this looks quite costly done for each fwprop.  And placing it before
> less costly bailouts even...
>
> See my discussion with Bernd anyway.
I read your last message as being OK with Bernd's approach?  Did I 
mis-understand?

jeff



More information about the Gcc-patches mailing list