This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR 23551: why should we coalesce inlined variables?


On Jul  9, 2007, "Richard Guenther" <richard.guenther@gmail.com> wrote:

> On 7/9/07, Alexandre Oliva <aoliva@redhat.com> wrote:
>> On Jul  9, 2007, "Richard Guenther" <richard.guenther@gmail.com> wrote:
>> 
>> > I suggested to have a on-the-side mapping (you need it for each
>> > function), like a hashtable that maps the SSA_NAME version to a list
>> > of user-visible DECLs.
>> 
>> I don't think it's that simple.  Consider the example I gave at
>> http://gcc.gnu.org/ml/gcc-patches/2007-07/msg00738.html
>> 
>> How do you envision it to work with an on-the-side mapping?  I don't
>> see how it could work, but I'd love to be proven wrong, because it
>> would indeed make my current assignment much simpler.

> If you have a list of variables per SSA_NAME then that problem is
> non-existant.

I don't see how.  Maybe it's not clear that, in the example above, foo
does have an initial value different from that of bar.

So, when we optimize away the assignment to foo at 1:, we can only
emit debug info for that change at that point if we keep some
annotation at that point indicating the change.

And if we don't optimize that assignment away, we end up with a copy
that we could have easily avoided.

You see what I'm getting at?  If I'm reading your suggestion right,
we might end up with something like: (all a single basic block)

   foo = <initial value>;
0: bar = <expr>;
   ...
1: foo = bar;
   ...
2: bar++;
3: foo--;
   ...
   use (bar)
   use (foo)

transformed to:

   foo_1 = <initial value>; # (foo)
0: bar_1 = <expr>; # (bar, foo)
   ...
1: ...
2:
3:
   ...
   use (bar_1 + 1);
   use (bar_1 - 1);

and then, how would we emit correct debug info for foo, or for bar at
3:?

-- 
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}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]