ipa.c (cgraph_remove_unreachable_node): Walk references of correct node...
authorJan Hubicka <jh@suse.cz>
Sun, 30 May 2010 08:21:41 +0000 (10:21 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 30 May 2010 08:21:41 +0000 (08:21 +0000)
* ipa.c (cgraph_remove_unreachable_node): Walk references of correct node;
remove references in node we no longer keep in cgrpah but need body
of.

From-SVN: r160046

gcc/ChangeLog
gcc/ipa.c

index bf55665bd7f87ee9b4b3ca666bc1a282651f5ea6..9d723532dac71a0654dcb55f17f5fb320159ef83 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-29  Jan Hubicka  <jh@suse.cz>
+
+       * ipa.c (cgraph_remove_unreachable_node): Walk references of correct node;
+       remove references in node we no longer keep in cgrpah but need body
+       of.
+
 2010-05-29  Jan Hubicka  <jh@suse.cz>
 
        * cgraph.c (cgraph_mark_reachable): Relax check for analyzed nodes.
index ebfc1a20ecd21691cace1650b87e7d6410947faa..906fa66d5694445bc44b3eb53ef63eb78c8d5d64 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -284,16 +284,19 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
             reachable too, unless they are direct calls to extern inline functions
             we decided to not inline.  */
          if (node->reachable)
-           for (e = node->callees; e; e = e->next_callee)
-             if (!e->callee->reachable
-                 && node->analyzed
-                 && (!e->inline_failed || !e->callee->analyzed
-                     || (!DECL_EXTERNAL (e->callee->decl))
-                     || before_inlining_p))
-               {
-                 e->callee->reachable = true;
-                 enqueue_cgraph_node (e->callee, &first);
-               }
+           {
+             for (e = node->callees; e; e = e->next_callee)
+               if (!e->callee->reachable
+                   && node->analyzed
+                   && (!e->inline_failed || !e->callee->analyzed
+                       || (!DECL_EXTERNAL (e->callee->decl))
+                       || before_inlining_p))
+                 {
+                   e->callee->reachable = true;
+                   enqueue_cgraph_node (e->callee, &first);
+                 }
+             process_references (&node->ref_list, &first, &first_varpool, before_inlining_p);
+           }
 
          /* If any function in a comdat group is reachable, force
             all other functions in the same comdat group to be
@@ -316,7 +319,8 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
             function is clone of real clone, we must keep it around in order to
             make materialize_clones produce function body with the changes
             applied.  */
-         while (node->clone_of && !node->clone_of->aux && !gimple_has_body_p (node->decl))
+         while (node->clone_of && !node->clone_of->aux
+                && !gimple_has_body_p (node->decl))
            {
              bool noninline = node->clone_of->decl != node->decl;
              node = node->clone_of;
@@ -326,7 +330,6 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
                  break;
                }
            }
-         process_references (&node->ref_list, &first, &first_varpool, before_inlining_p);
        }
       if (first_varpool != (struct varpool_node *) (void *) 1)
        {
@@ -367,6 +370,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
       if (node->aux && !node->reachable)
         {
          cgraph_node_remove_callees (node);
+         ipa_remove_all_references (&node->ref_list);
          node->analyzed = false;
          node->local.inlinable = false;
        }