This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, PR 45934] Devirtualization aware of dynamic type changes
On Tue, Nov 23, 2010 at 03:31:37PM +0100, Richard Guenther wrote:
> On Tue, 23 Nov 2010, Jan Hubicka wrote:
> > > For 4.6 please consider reverting back to the non-broken 4.5 state,
> > > I don't really feel comfortable with more experimenting during stage3.
> > Was 4.5 really non-broken? My understanding was that the problem with dynamic
> > type changes was always present, just less often triggering.
> The problem of course was there, but IIRC we weren't trying to
> devirtualize as aggressively as we do now, no?
4.5 folds OBJ_TYPE_REFs only in the simplest possible scenarios (the
object is a &decl), in partcular it does not attempt to fold calls to
virtual methods of ancestors of the declaration (which would be
represented by an object like &decl.D.1234). Therefore there are no
problems with thunks or dynamic changes of types because only the
ancestor part changes types.
It does not check for globalness of the object so it we probably might
construct a testcase that would unexpectedly fail when devirtualizing
according to a global object but I believe such a testcase would be
invalid because IIRC C++ standard does not allow you to access the
object under creation or destruction with a type of its descendant.
In short, I don't think that devirtualization in 4.5 has any problems.
However I also think it is not very useeful because it works only when
you have virtual methods but no inheritance.