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: pretty-ipa merge part 19: Clonning infrastructure


> On Tue, 12 May 2009, Jan Hubicka wrote:
> 
> > > >
> > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40079
> > 
> > Hi,
> > there is one remaining thunk-3.C failure showing on some targets.  It is
> > interesting problem: there is virtual constructor bar with associated
> > thunk.  We manage to devirutalize only call to bar and render table of
> > virtual methods unnecesary, as a result we remove function bar itself in
> > favour of its clone where we propagate some constant.
> > 
> > Problem is that clonning of decl is done via copy_decl and
> > emit_associated_thunks later called when compiling the clone results in
> > emitting thunk (that is dead) pointing to the original function
> > resulting in reference to undefined symbol.
> > 
> > Mark, is there any easy way to prevent C++ from emitting thunks on
> > clones? If not, I can fix it on callgraph side: simply track what nodes
> 
> They are emitted at the time the clones are created - thus very early.

No, they are emitted via langhook from assemble_function, so only when
function is getting compiled.  Only problem here is that as we copy the
declaration, we copy pointer to list of associated thunks, so when
emitting clone and not emitting original, we end up with undefined
pointer.
> 
> The proper fix is to defer to the inliner to do the cloning and to
> re-implement thunks like Diego suggested for LTO.  For the former

Yep, in longer run we need to make clones part of callgraph.

Honza
> I had sent some patches in the past, as part of bringing gimplification
> to unit-at-a-time (at least to you personally, I don't remember if
> I sent the inliner parts to the list).
> 
> Richard.


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