Hi, On Tue, Apr 19, 2011 at 02:15:18AM +0200, Jan Hubicka wrote: > Actually what happens here is that CCP devirtualize by propagating the > constructors and due to Richard's new code to drop OBJ_TYPE_REF we finally get > a direct call. This is all good and desirable. > > I think good solution would be to fold further and inline the thunk > adjustment, just like the type based devirtualization does. Even > once I get far enough with my cgraph cleanuping project to make > cgraph represent thunks nicely, we would win if in these cases ccp > and other passes simply inlined the this adjustment, like we do with > type based devirtualization already.
> Martin, I guess it is matter of looking up the thunk info by > associated cgraph node alias and extending fold_stmts of passes that > now drop the OBJ_TYPE_REF wrappers? Well, if you have a cgraph node then yes. But if the method is implemented in a different compilation unit you don't. And as I already said today on IRC, I don't think it is possible to tell whether a function is a thunk by looking at the decl alone (the front hand has a flag for it as Jakub noted, though), let alone what kind of thunk it is. The more I think about this the more I would also like to make thunks as ordinary real functions as possible, with perhaps some kind of totally opaque decls/cgraph_nodes for the most obscure types which could be generated by assembly. Martin