> But this caused bug 60347: turns out that we shouldn't do this > unless the vtable (and thus the contents of the vtable) are used.
The ipa-devirt type inheritance builder will use any vtable it finds in DECL_BINFO of types that it knows about. It starts with types of virtual methods and virtual tables in the symbol table (so we should be sure that TREE_USED is set for vtable that is associated with virtual method is set when virtual method itself is used). But it will drop in also all base types of those types and then it will take types found in OBJ_TYPE_REF & types from variables and type arguments. Are all those safe? I tried to describe this in http://hubicka.blogspot.ca/2014/02/devirtualization-in-c-part-3-building.html Honza