PR 23551: why should we coalesce inlined variables?

Alexandre Oliva aoliva@redhat.com
Mon Jul 9 17:12:00 GMT 2007


On Jul  9, 2007, Michael Matz <matz@suse.de> wrote:

> Hi,
> On Mon, 9 Jul 2007, Alexandre Oliva wrote:

>> On Jul  9, 2007, "Richard Guenther" <richard.guenther@gmail.com> wrote:
>> 
>> > Actually in ssa_form your example looks like
>> 
>> Yeah, that's just after turning it into SSA.  How about after 
>> optimization?  Why wouldn't we coalesce foo_2 with bar_1 and propagate 
>> bar_2 and foo_3 into the uses (assume they're just assignments to other 
>> variables).

> If they are just assignments then both SSA names hold the same values 
> (i.e. are backed by the same user variables), so there's no distinction 
> between them in debug info.

No, that's not true.

0:/* foo = */ foo_1 = <initial value>;
1:/* bar = */ bar_1 = <expr>;
2:...
3:/* foo = bar_1; */
4:/* bar = bar_1 + 1; */
5:/* foo = bar_1 - 1; */
6: use (bar_1 + 1);
   use (bar_1 - 1);

Correct debug info for bar:

range value
1..5  bar_1
5...  bar_1 + 1

Correct debug info for foo:

range value
0..4  foo_1
4..6  bar_1
6...  bar_1 - 1

Your suggested debug info for foo:

range value
0..2  foo_1
2..6  bar_1
6...  bar_1 - 1

See the s/4/2/ ?  That would be a bug.

> Of course you have to make sure, that if you do such propagation
> that you merge the lists of associated variables for the involved
> SSA names.

This is not enough.  The ranges matter.

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}



More information about the Gcc-patches mailing list