This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Whole program optimization and functions-only-called-once.
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jan Hubicka <hubicka at ucw dot cz>, Toon Moene <toon at moene dot org>, Richard Guenther <richard dot guenther at gmail dot com>, Jan Hubicka <jh at suse dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 27 Nov 2009 17:21:12 +0100
- Subject: Re: Whole program optimization and functions-only-called-once.
- References: <4AF1D3C2.3000001@moene.org> <84fc9c000911041126x14ce9226w9dfb781ea284de6b@mail.gmail.com> <20091112161638.GC11341@atrey.karlin.mff.cuni.cz> <4AFEA884.9030003@moene.org> <20091116095435.GU24874@kam.mff.cuni.cz> <20091125163957.GB6288@virgil.suse.cz>
> > 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