Small refactoring of cgraph_node::release_body
authorJan Hubicka <jh@suse.cz>
Wed, 31 Mar 2021 09:35:29 +0000 (11:35 +0200)
committerJan Hubicka <jh@suse.cz>
Wed, 31 Mar 2021 09:35:29 +0000 (11:35 +0200)
PR lto/99447
* cgraph.c (cgraph_node::release_body): Remove all callers and
references.
* cgraphclones.c (cgraph_node::materialize_clone): Do not do it here.
* cgraphunit.c (cgraph_node::expand): And here.

gcc/cgraph.c
gcc/cgraphclones.c
gcc/cgraphunit.c

index 8014075..b77c676 100644 (file)
@@ -1860,6 +1860,9 @@ cgraph_node::release_body (bool keep_arguments)
       lto_free_function_in_decl_state_for_node (this);
       lto_file_data = NULL;
     }
+  gcc_assert (!clones);
+  remove_callees ();
+  remove_all_references ();
 }
 
 /* Remove function from symbol table.  */
index 95103a4..9f86463 100644 (file)
@@ -1143,11 +1143,7 @@ cgraph_node::materialize_clone ()
   /* Function is no longer clone.  */
   remove_from_clone_tree ();
   if (!this_clone_of->analyzed && !this_clone_of->clones)
-    {
-      this_clone_of->release_body ();
-      this_clone_of->remove_callees ();
-      this_clone_of->remove_all_references ();
-    }
+    this_clone_of->release_body ();
 }
 
 #include "gt-cgraphclones.h"
index 1c74cee..0b70e4d 100644 (file)
@@ -1892,10 +1892,6 @@ cgraph_node::expand (void)
      comdat groups.  */
   assemble_thunks_and_aliases ();
   release_body ();
-  /* Eliminate all call edges.  This is important so the GIMPLE_CALL no longer
-     points to the dead function body.  */
-  remove_callees ();
-  remove_all_references ();
 }
 
 /* Node comparator that is responsible for the order that corresponds