This is the mail archive of the gcc@gcc.gnu.org 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 Thu, 30 Oct 2003, Richard Guenther wrote:
> 
> > Well, I wouldnt need to have it in official 3.4, I just use a locally
> > patched gcc for my work. Btw. I tried the above (but obviously missed some
> > parts, as it doesnt work), see attached patch. I somehow circumvented most
> > of the problems you mention above, but it seems the functions are not
> > considered for inlining though cgraph_inline_p is modified to honour
> > the case of a callee of a leafify function (you didnt mean
> > cgraph_inline_p by inline_call_p?).
> 
> 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:http://gcc.gnu.org/bugs.html> 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.

> +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.

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.

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.

Thanks,
Honza


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