> On Mon, 18 Apr 2011, Jan Hubicka wrote: > > > > Ah, no. We _did_ that in CCP but now we only adjust the OBJ_TYPE_REF > > > expr in CCP and defer to fold_stmt to eventually "devirtualize" it. > > > See PR45878. Then rev.165435 was necessary, as we dropped OBJ_TYPE_REF > > > for the non-devirtualized call as well. As both cases were because > > > > Hmm, sounds slipperly. > > In any case OBJ_TYPE_REF of constant argument should be banned, or > > we would need to extend gimple_call_fndecl to return contained fndecl. > > Yeah, I thought about this as well ... > > > Devirtualization without enabling an inlining is essentially useless > > transform > > and it is precisely what we do now on this testcase... > > Well, it transforms an indirect into a direct call (unless we handle > direct OBJ_TYPE_REF calls in gimple_call_fndecl of course).
Well, I meant that producing OBJ_TYPE_REF(foo,XY) is useless as long as callgraph will not notice as a direct call. So either we want gimple_call_fndecl to look into OBJ_TYPE_REF or we want to sanity check that no indirect edges in callgraph have this form. In general it does not matter much if we emit direct or indirect call on modern hardware, but we are better to be sure that devirtualization mahcinery leads to calls we can inline. > > > > of type conversion issues this should be fixed with separating the > > > call function type as we do now. > > > > > > I'll look into handling copyprop and FRE similarly. > > > > Thanks, I would not even mind having some automatic check that the constant > > OBJ_TYPE_REFs don't leak at cgraph edge construction time... > > Honza > > I still have no idea what this OBJ_TYPE_REF is for and why we need to > preserve it ... (apart from for the weirt type-based devirtualization). Weirdness seems to be nature of devirtualization in C++ :(, but we should find way how to be effective on it... I would be surprised if OBJ_TYPE_REF of an constant paid any difference for it. Honza > > Richard.