Hi,

the following patch backports 4.5 behavior to 4.4 IPA-CP
initialization when it decides which nodes need to be duplicated (we
often say cloned, but cloning is an overloaded term in gcc) in order
to modify them.  In 4.5, this is decided by a new predicate called
cgraph_only_called_directly_p which checks both node->needed and
node->local.externally_visible, whereas 4.4 looks only at the needed
flag.

As described in the PR, this wrecks havoc for ipcp_update_callgraph
which is the stage of the old IPA-CP when it undoes its decisions
which turned out not to be safe.

Bootstrapped and tested on x86_64-linux, OK for the branch?

Thanks,

Martin


2012-02-29  Martin Jambor  <mjam...@suse.cz>

        PR tree-optimization/52430
        * ipa-cp.c (ipcp_initialize_node_lattices): Also consider
        node->local.externally_visible as needed.

Index: gcc/ipa-cp.c
===================================================================
--- 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.  */

Reply via email to