Type inheritance graph analysis & speculative devirtualization, part 2/6 (type inheritance graph builder)

Jan Hubicka hubicka@ucw.cz
Mon Aug 19 08:55:00 GMT 2013


> 
> I believe you can get derived objects of derived type not visible in the tu, so the list of targets does only contain local methods and implicitly all methods only defined in other tus? That is, you cannot rely no that list to be complete?

Yes, the list is in majority cases not complete. It is complete when you deal
with virtual method comming from object in local namespaces or final
classes/methods (this info we do not pass to middle-end yet). There is "final"
flag passed from possible_polymorphic_call_targets to you saying when this
happens.

I am currently using it for compile time unreachable code removal. I.e. to
remove known to be unreachable comdat&external virtual function bodies rather
then pickling them all to LTO and remove them post inlining when we assume
devirt to no longer happen.  I alos use it for speculative devirtualization
(i.e when I only see one possible virtual call candidate on LTO I believe it is
likely to be the one called on runtime).

There are some cases where you can get more complete information but in general
this is not meant to replace the current code that is tracking lists of
possible dynamic object types reaching to given call.  It is kind of ortoghonal
to it.

Honza



More information about the Gcc-patches mailing list