This is the mail archive of the gcc-patches@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: Whole program optimization and functions-only-called-once.


> > Index: tree-inline.c
> > ===================================================================
> > *** tree-inline.c	(revision 154198)
> > --- tree-inline.c	(working copy)
> > *************** expand_call_inline (basic_block bb, gimp
> > *** 3822,3827 ****
> > --- 3821,3830 ----
> >     (*debug_hooks->outlining_inline_function) (cg_edge->callee->decl);
> >   
> >     /* Update callgraph if needed.  */
> > +   if (cg_edge->callee->clone_of
> > +       && !cg_edge->callee->clone_of->next_sibling_clone
> > +       && !cg_edge->callee->analyzed)
> > +     cgraph_remove_node (cg_edge->callee);
> >     cgraph_remove_node (cg_edge->callee);
> 
> I guess you forgot to remove the unconditional call to
> cgraph_remove_node.  The conditional one was probably never executed
> when testing, by the way.

Ah, it should be cg_edge->calle->clone_of (since I was wondering about situation
where master of clone is kept around just to futfil inlining, but perhaps this is
not really needed, since we turn the masters into inline clones in unreachable function
removal when masters are unreachable).
So I will just drop this hunk, obviously we would ICE here if it ever matched.
> 
> >   
> >     id->block = NULL_TREE;
> > *************** tree_function_versioning (tree old_decl,
> > *** 4848,4853 ****
> > --- 4851,4869 ----
> >     id.src_node = old_version_node;
> >     id.dst_node = new_version_node;
> >     id.src_cfun = DECL_STRUCT_FUNCTION (old_decl);
> > +   if (id.src_node->ipa_transforms_to_apply)
> > +     {
> > +       VEC(ipa_opt_pass,heap) * old_transforms_to_apply = id.dst_node->ipa_transforms_to_apply;
> > +       unsigned int i;
> > + 
> > +       id.dst_node->ipa_transforms_to_apply = VEC_copy (ipa_opt_pass, heap,
> > + 					               id.src_node->ipa_transforms_to_apply);
> > +       for (i = 0; i < VEC_length (ipa_opt_pass, old_transforms_to_apply); i++)
> > +         VEC_safe_push (ipa_opt_pass, heap, id.dst_node->ipa_transforms_to_apply,
> > + 		       VEC_index (ipa_opt_pass,
> > + 		       		  old_transforms_to_apply,
> > + 				  i));
> > +     }
> 
> This really looks like doubling the contents of the vector, rather
> than copying it once.  Or am I missing something?

Ha, you are right, the VEC_copy was leftover of previous implementation.  Will fix that too.
(we need to concatenate the orignal and new, since the clone now might have transformations
already enqueued).  I guess this only passes by chance since we don't really have transform
except for apply_inline.

Honza
> 
> By the way, is it OK to copy it when cloning the body rather than when
> creating virtual clones?  (If so, I wonder whether it is necessary at
> all.)
> 
> Thanks,
> 
> Martin


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