This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: attribute((leafify)) for 3.4

On Fri, 31 Oct 2003, Jan Hubicka wrote:

> > On Thu, 30 Oct 2003, Richard Guenther wrote:
> > I missed to mark the cgraph edges created after inlining, with this chunk
> > added I get leafify behavior as wanted.  But I still see these artificial
> > libstdc++ functions not inlined - they seem to be triggered by temporary
> > objects created inside the loop and never optimized away (as 3.3 did).
> > I'll try to dig further and come up with a testcase.
> >
> > (Final) patch is attached. It breaks debugging (-g3) with the following
> > ICE:
> >
> > /home/rguenth/ix86/pooma/tat-serial-gcc34/pooma/linux/src/Evaluator/InlineEvaluator.h:102:
> > internal compiler error: in gen_subprogram_die, at dwarf2out.c:10607
> > Please submit a full bug report,
> > with preprocessed source if appropriate.
> > See <URL:> for instructions.
> > make: *** [tramp3d.o] Error 1
> >
> > It seems that unnecessary (inlined) function bodies are emit and
> > debugging is confused by this. But I really dont know how to prevent
> > this. Linking is fine. Any idea?
> Dwarf2out emits abstract debug infromation for functions that are
> inlined.
> This crash usually happens when function is inlined but the debug
> information is missing.  You probably need to fix:
> /* Return true when the DECL can possibly be inlined.  */
> bool
> cgraph_function_possibly_inlined_p (tree decl)
> {
>   if (!cgraph_global_info_ready)
>     return (DECL_INLINE (decl) && !flag_no_inline);
>   return cgraph_node (decl)->global.inlined;
> }
> To return true for functions inlined by leafifying.

Ah, ok. I missed this, fixed by setting e->callee->global.inlined to 1 in

> > +static void
> > +cgraph_decide_inlining_leafify(struct cgraph_node *node)
> > +{
> > +  struct cgraph_edge *e;
> > +  if (node->aux)
> > +    return;
> > +  for (e = node->callees; e; e = e->next_callee)
> > +    {
> > +      e->maybe_inline_call = 1;
> > +      cgraph_decide_inlining_leafify(e->callee);
> > +    }
> In general we are trying to avoid recursion over loop depth.  You will
> also need to behave somewhat sanely in the case of recursion (either not
> inline the reucursive call or error out.

It's tail recursion, so it shouldn't be bad.  Also I moved node->aux
initialization up to avoid going endlessly through callgraph loops.
Recursive inlining seems to be prevented somehow at least for not-direct
recursing, for direct recursing I added a check in the mark routine. So
cgraph_decide_inlining_leafify() looks now like

static void
cgraph_decide_inlining_leafify(struct cgraph_node *node)
  struct cgraph_edge *e;
  if (node->aux)
  node->aux = node;
  for (e = node->callees; e; e = e->next_callee)
      if (e->callee == node)
      e->maybe_inline_call = 1;
      e->callee->global.inlined = 1;

> In general the cgraph changes looks acceptable for me for 3.4 given that
> I will reorganize this somewhat in 3.5 anyway.
> However you will need to wait for global write maintainer to agree on the
> rest of patch and concept of leafify argument and decision whether such
> a change is acceptable in stage 3.

I won't submit this officially for 3.4, as I dont have a copyright
assignment yet and I suspect this would last too long to be accepted late
in stage 3 anyways. Also the concept of leafify needs some arguments.
Apart from this I think it is trivial for you to implement this
functionality after cleanup in 3.5, so I wont need to fiddle around with
copyright assignments.

> Please also use -c3p for diffing so the functio names appear in the
> diff.  It would make it more readable.  Also there seem to be some
> formating problems (perhaps just tabs replaced by spaces) in your patch.

Ah, never saw -p, this one is really useful.

Updated patch attached for those who are interested.



Richard Guenther <richard dot guenther at uni-tuebingen dot de>

Attachment: leafify-3.4-9
Description: leafify patch

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]