cgraph.c (cgraph_node::release_body): Free function_in_decl_state.
authorJan Hubicka <hubicka@ucw.cz>
Thu, 12 Mar 2015 00:14:19 +0000 (01:14 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 12 Mar 2015 00:14:19 +0000 (00:14 +0000)
* cgraph.c (cgraph_node::release_body): Free function_in_decl_state.
(cgraph_node::remove): Likewise.
(cgraph_node::get_untransformed_body): Likewise.
* varpool.c (varpool_node::remove): Likewise.
(varpool_node::get_constructor): Add sanity check.
* lto.c (read_cgraph_and_symbols): Do not do merging
at ltrans stage.

From-SVN: r221366

gcc/ChangeLog
gcc/cgraph.c
gcc/lto/ChangeLog
gcc/lto/lto.c
gcc/varpool.c

index e451495c724d1ad72c49eab133e82121bdb82daf..53f582b5e967af98329d1587a266b7b21865750c 100644 (file)
@@ -1,3 +1,11 @@
+2015-03-10  Jan Hubicka  <hubicka@ucw.cz>
+
+       * cgraph.c (cgraph_node::release_body): Free function_in_decl_state.
+       (cgraph_node::remove): Likewise.
+       (cgraph_node::get_untransformed_body): Likewise.
+       * varpool.c (varpool_node::remove): Likewise.
+       (varpool_node::get_constructor): Add sanity check.
+
 2015-03-11  Sandra Loosemore  <sandra@codesourcery.com>
 
        * doc/invoke.texi (-fgnu89-inline): Remove discussion about 
index 5ca19015a3dc2693304390be87c6d3cf442d180e..ede58bf5aaf8f4e71b2f3e7bf6da5e9981edb86b 100644 (file)
@@ -1721,7 +1721,10 @@ cgraph_node::release_body (bool keep_arguments)
     DECL_INITIAL (decl) = error_mark_node;
   release_function_body (decl);
   if (lto_file_data)
-    lto_free_function_in_decl_state_for_node (this);
+    {
+      lto_free_function_in_decl_state_for_node (this);
+      lto_file_data = NULL;
+    }
 }
 
 /* Remove function from symbol table.  */
@@ -1799,13 +1802,18 @@ cgraph_node::remove (void)
       n = cgraph_node::get (decl);
       if (!n
          || (!n->clones && !n->clone_of && !n->global.inlined_to
-             && (symtab->global_info_ready
+             && ((symtab->global_info_ready || in_lto_p)
                  && (TREE_ASM_WRITTEN (n->decl)
                      || DECL_EXTERNAL (n->decl)
                      || !n->analyzed
                      || (!flag_wpa && n->in_other_partition)))))
        release_body ();
     }
+  else
+    {
+      lto_free_function_in_decl_state_for_node (this);
+      lto_file_data = NULL;
+    }
 
   decl = NULL;
   if (call_site_hash)
@@ -3218,6 +3226,8 @@ cgraph_node::get_untransformed_body (void)
   lto_free_section_data (file_data, LTO_section_function_body, name,
                         data, len);
   lto_free_function_in_decl_state_for_node (this);
+  /* Keep lto file data so ipa-inline-analysis knows about cross module
+     inlining.  */
 
   timevar_pop (TV_IPA_LTO_GIMPLE_IN);
 
index 994189f75b0c86c7981090eda98ef63b4cbd6f57..ae379ebb4f96a6d9f90787a20201130775e4c52f 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-10  Jan Hubicka  <hubicka@ucw.cz>
+
+       * lto.c (read_cgraph_and_symbols): Do not do merging
+       at ltrans stage.
+
 2015-02-26  Jakub Jelinek  <jakub@redhat.com>
 
        * lto.c (lto_mode_identity_table): New variable.
index ce7e6b1974a74353cd46bfc301a2d309a67b6973..760975fdf258874af044c1ba00f5170d8869c6f1 100644 (file)
@@ -3118,13 +3118,20 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
       fprintf (symtab->dump_file, "Before merging:\n");
       symtab_node::dump_table (symtab->dump_file);
     }
-  lto_symtab_merge_symbols ();
-  /* Removal of unreachable symbols is needed to make verify_symtab to pass;
-     we are still having duplicated comdat groups containing local statics.
-     We could also just remove them while merging.  */
-  symtab->remove_unreachable_nodes (dump_file);
+  if (!flag_ltrans)
+    {
+      lto_symtab_merge_symbols ();
+      /* Removal of unreachable symbols is needed to make verify_symtab to pass;
+        we are still having duplicated comdat groups containing local statics.
+        We could also just remove them while merging.  */
+      symtab->remove_unreachable_nodes (dump_file);
+    }
   ggc_collect ();
   symtab->state = IPA_SSA;
+  /* FIXME: Technically all node removals happening here are useless, because
+     WPA should not stream them.  */
+  if (flag_ltrans)
+    symtab->remove_unreachable_nodes (dump_file);
 
   timevar_pop (TV_IPA_LTO_CGRAPH_MERGE);
 
index 707f62f0d848d04a30ddcd50ee2212ab4dcf9d82..b5836934d72526edb2fbd15bf3dcded912fb7743 100644 (file)
@@ -195,6 +195,11 @@ void
 varpool_node::remove (void)
 {
   symtab->call_varpool_removal_hooks (this);
+  if (lto_file_data)
+    {
+      lto_free_function_in_decl_state_for_node (this);
+      lto_file_data = NULL;
+    }
 
   /* When streaming we can have multiple nodes associated with decl.  */
   if (symtab->state == LTO_STREAMING)
@@ -323,6 +328,7 @@ varpool_node::get_constructor (void)
                 name);
 
   lto_input_variable_constructor (file_data, this, data);
+  gcc_assert (DECL_INITIAL (decl) != error_mark_node);
   lto_stats.num_function_bodies++;
   lto_free_section_data (file_data, LTO_section_function_body, name,
                         data, len);