[PR42630] reset debug insns referencing unroll-expanded vars
Richard Guenther
richard.guenther@gmail.com
Fri Jan 8 12:26:00 GMT 2010
On Fri, Jan 8, 2010 at 1:16 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Fri, Jan 8, 2010 at 8:21 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
>> -fvariable-expansion-in-unroller wants to turn:
>>
>> <loop>
>> ...
>> R = R + 1
>> ...
>> <endloop>
>>
>> into
>>
>> R' = 0
>> <loop>
>> ...
>> R = R + 1
>> ...
>> <unrolled>
>> ...
>> R' = R' + 1
>> ...
>> <endloop>
>> R = R + R'
>>
>> It requires R to be referenced in a single insn. This means a debug
>> insn would disable the optimization. That was easy to fix.
>>
>> Not so easy was figuring out how to adjust the debug insns. Consider:
>>
>> <loop>
>> ...
>> R = R + 1
>> # debug var => R
>> ...
>> <endloop>
>> # debug var => R
>>
>> We could correctly expand this to:
>>
>> R' = 0
>> <loop>
>> ...
>> R = R + 1
>> # debug var => R + R'
>> ...
>> <unrolled>
>> ...
>> R' = R' + 1
>> # debug var => R + R'
>> ...
>> <endloop>
>> R = R + R'
>> # debug var => R
>>
>> However, taking note of which debug insns will require updating because
>> of each expanded var, and performing the updates at the end, turned out
>> to require working too hard. I decided to just reset the debug insns
>> instead, which at least fixes the incorrect debug info we'd get if we
>> left them alone referencing the original R.
>>
>> Ok to install if it passes regstrapping?
>
> You need to free body in reset_debug_uses_in_loop.
>
> Otherwise ok - even though I don't like a 2nd pass over all basic blocks
> in the loop too much. I suppose you couldn't have avoided copying
> the debug insn during the unrolling instead?
Having a 2nd look there should be exactly one such debug insn, so
why not reset it in referenced_in_one_insn_in_loop_p instead,
moving the mode checks before the call. Also referenced_in_one_insn_in_loop_p
also needs to free body.
Richard.
> Thanks,
> Richard.
>
>>
>>
>> --
>> Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
>> You must be the change you wish to see in the world. -- Gandhi
>> Be Free! -- http://FSFLA.org/ FSF Latin America board member
>> Free Software Evangelist Red Hat Brazil Compiler Engineer
>>
>>
>
More information about the Gcc-patches
mailing list