On Fri, Mar 02, 2012 at 06:54:13PM +1300, Maxim Kuvyrkov wrote:
> > --- gcc/ipa-cp.c (revision 184662)
> > +++ gcc/ipa-cp.c (working copy)
> > @@ -508,7 +508,7 @@ ipcp_initialize_node_lattices (struct cg
> >
> > if (ipa_is_called_with_var_arguments (info))
> > type = IPA_BOTTOM;
> > - else if (!node->needed)
> > + else if (!node->needed && !node->local.externally_visible)
> > type = IPA_TOP;
> > /* When cloning is allowed, we can assume that externally visible
> > functions
> > are not called. We will compensate this by cloning later. */
>
> Because this is for a branch, I would be more conservative and avoid any
> new instances of IPA_TOP -- those that can be obtained from subsequent
> else-if clauses. I.e.,
>
> else if (!node->needed)
> type = !node->local.externally_visible ? IPA_TOP : IPA_BOTTOM;
The above doesn't add any new instances of IPA_TOP, the
node->local.externally_visible && !node->needed
will be either IPA_BOTTOM, if not desirable for cloning, or IPA_TOP with
n_cloning_candidates++ (previously they would all be IPA_TOP).
I think Martin's patch as is is fine.
Jakub