RFA (cgraph): C++ 'structor decloning patch, Mark III

Jan Hubicka hubicka@ucw.cz
Tue Dec 10 10:06:00 GMT 2013


> > diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
> > index fbb63da..aa49bfe 100644
> > --- a/gcc/ipa-inline.c
> > +++ b/gcc/ipa-inline.c
> > @@ -230,6 +230,25 @@ report_inline_failed_reason (struct cgraph_edge *e)
> >      }
> >  }
> >  
> > +/* True iff NODE calls another function which is local to its comdat
> > +   (i.e. C++ decloned constructor); in that case, calls to NODE cannot be
> > +   inlined, as that would cause a reference from outside the comdat to the
> > +   local symbol.  If we inline the call from NODE to the local function,
> > +   then inlining NODE can succeed.  */
> > +
> > +static bool
> > +calls_comdat_local_p (struct cgraph_node *node)
> > +{
> > +  if (!node->same_comdat_group)
> > +    return false;
> > +  for (struct cgraph_edge *e = node->callees; e; e = e->next_callee)
> > +    {
> > +      if (comdat_local_p (e->callee))
> > +	return true;
> > +    }
> > +  return false;
> > +}

Also this is not correct - because it ignores functions inlined into NODE and
use in can_inline_edge_p will lead to quadratic time issues.  We probably want
ipa-inline to compute flag if function refer to local symbol just before
inlining starts and propagate it across inlining decisions in make_edge_inline
and only check the flag in can_inline_edge_p.

Honza



More information about the Gcc-patches mailing list