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: [PATCH, PR 46053] Devirtualization and thunks revisited


> On Thu, 21 Oct 2010, Martin Jambor wrote:
> 
> > Hi,
> > 
> > PR 46053 showed that my previous attempt to incorporate thunks to
> > devirtualization (fix to PR 45699) was only half-baked and did not
> > work when we do devirtualization after IPA propagation of type
> > information (rather obviously, I must admit).
> > 
> > Basically, some thunk or delta information has to be attached to
> > indirect edges representing polymorphic calls too.  However, I did not
> > like the idea of having thunks as callees of cgraph edges and,
> > moreover, there have been concerns that direct calls to thunks might
> > be unintelligible to some our analyses as well.
> > 
> > So I revisited the whole approach to devirtualization to thunks which
> > are there to adjust the this offset by a delta and resorted to adding
> > delta to the parameter directly in the caller.  In order to do this, I
> > save the delta in the indirect_info of an originally-indirect edge.
> > 
> > Because generating a delta addition statement is impossible when
> > folding a statement inplace, I rearranged the folding code a bit as
> > well. 
> > 
> > This patch is to be applied on top of
> > http://gcc.gnu.org/ml/gcc-patches/2010-10/msg01328.html
> > (It might apply and work without it but I have not tried it).
> > 
> > Bootstrapped and tested on x86_64-linux without any problems.  OK for
> > trunk (preferably after the patch referenced above)?
> 
> Without actually looking at the patch I think that call edges
> to thunks make more sense, how'd you otherwise represent a direct
> call to it (and thus possibly inline it)?

At beggining we have no direct calls to thunks.  One approach is to always inlie
the thunk code when turning indirect call to the direct call that IMO makes most
sense.  This I guess can hapen as part of statement folding, but I am not 100% sure
(since we will be producing more statements for one folded call)

Honza


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