public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-7926] Small refactoring of cgraph_node::release_body
@ 2021-03-31  9:35 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2021-03-31  9:35 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d7145b4bb6c8729a1e782373cb6256c06ed60465

commit r11-7926-gd7145b4bb6c8729a1e782373cb6256c06ed60465
Author: Jan Hubicka <jh@suse.cz>
Date:   Wed Mar 31 11:35:29 2021 +0200

    Small refactoring of cgraph_node::release_body
    
            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.

Diff:
---
 gcc/cgraph.c       | 3 +++
 gcc/cgraphclones.c | 6 +-----
 gcc/cgraphunit.c   | 4 ----
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 80140757d16..b77c676a58a 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -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.  */
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index 95103a423f7..9f86463b42d 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -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"
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 1c74cee69ac..0b70e4d4fde 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-31  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  9:35 [gcc r11-7926] Small refactoring of cgraph_node::release_body Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).