PR lto/54728
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 22 Dec 2012 23:27:49 +0000 (23:27 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 22 Dec 2012 23:27:49 +0000 (23:27 +0000)
* cgraph.h (symtab_real_symbol_p): Drop code looking for external functions.
* lto-streamer-out.c (output_symbol_p): New function.
(produce_symtab) Use it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194700 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cgraph.h
gcc/lto-streamer-out.c

index 8bc25ed..d625bb1 100644 (file)
@@ -1,3 +1,10 @@
+2012-12-22  Jan Hubicka  <jh@suse.cz>
+
+       PR lto/54728
+       * cgraph.h (symtab_real_symbol_p): Drop code looking for external functions.
+       * lto-streamer-out.c (output_symbol_p): New function.
+       (produce_symtab) Use it.
+
 2012-12-21  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/55355
index 28c3497..d783862 100644 (file)
@@ -1357,7 +1357,6 @@ static inline bool
 symtab_real_symbol_p (symtab_node node)
 {
   struct cgraph_node *cnode;
-  struct ipa_ref *ref;
 
   if (!is_a <cgraph_node> (node))
     return true;
@@ -1366,11 +1365,6 @@ symtab_real_symbol_p (symtab_node node)
     return false;
   if (cnode->abstract_and_needed)
     return false;
-  /* We keep virtual clones in symtab.  */
-  if (!cnode->analyzed
-      || DECL_EXTERNAL (cnode->symbol.decl))
-    return (cnode->callers
-           || ipa_ref_list_referring_iterate (&cnode->symbol.ref_list, 0, ref));
   return true;
 }
 #endif  /* GCC_CGRAPH_H  */
index 853b155..85c36c6 100644 (file)
@@ -1257,6 +1257,26 @@ write_symbol (struct streamer_tree_cache_d *cache,
   lto_output_data_stream (stream, &slot_num, 4);
 }
 
+/* Return true if NODE should appear in the plugin symbol table.  */
+
+bool
+output_symbol_p (symtab_node node)
+{
+  struct cgraph_node *cnode;
+  struct ipa_ref *ref;
+
+  if (!symtab_real_symbol_p (node))
+    return false;
+  /* We keep external functions in symtab for sake of inlining
+     and devirtualization.  We do not want to see them in symbol table as
+     references.  */
+  cnode = dyn_cast <cgraph_node> (node);
+  if (cnode && DECL_EXTERNAL (cnode->symbol.decl))
+    return (cnode->callers
+           || ipa_ref_list_referring_iterate (&cnode->symbol.ref_list, 0, ref));
+  return true;
+}
+
 
 /* Write an IL symbol table to OB.
    SET and VSET are cgraph/varpool node sets we are outputting.  */
@@ -1285,7 +1305,7 @@ produce_symtab (struct output_block *ob)
     {
       symtab_node node = lsei_node (lsei);
 
-      if (!symtab_real_symbol_p (node) || DECL_EXTERNAL (node->symbol.decl))
+      if (!output_symbol_p (node) || DECL_EXTERNAL (node->symbol.decl))
        continue;
       write_symbol (cache, &stream, node->symbol.decl, seen, false);
     }
@@ -1294,7 +1314,7 @@ produce_symtab (struct output_block *ob)
     {
       symtab_node node = lsei_node (lsei);
 
-      if (!symtab_real_symbol_p (node) || !DECL_EXTERNAL (node->symbol.decl))
+      if (!output_symbol_p (node) || !DECL_EXTERNAL (node->symbol.decl))
        continue;
       write_symbol (cache, &stream, node->symbol.decl, seen, false);
     }