lto-cgraph.c (get_alias_symbol): Remove weakref sanity check.
authorJan Hubicka <jh@suse.cz>
Tue, 4 Jun 2013 22:58:22 +0000 (00:58 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 4 Jun 2013 22:58:22 +0000 (22:58 +0000)
* lto-cgraph.c (get_alias_symbol): Remove weakref sanity check.
(input_node, input_varpool_node): Handle correctly external same
body aliases.
* ipa.c (symtab_remove_unreachable_nodes): Do not remove external
nodes at ltrans stage.

From-SVN: r199675

gcc/ChangeLog
gcc/ipa.c
gcc/lto-cgraph.c

index 690c9680e613018092054d2bbfbd06cfd0f54848..c168af8587883c2fcf4486f8a764ec13fa9ba1c7 100644 (file)
@@ -1,3 +1,11 @@
+2013-06-04  Jan Hubicka  <jh@suse.cz>
+
+       * lto-cgraph.c (get_alias_symbol): Remove weakref sanity check.
+       (input_node, input_varpool_node): Handle correctly external same
+       body aliases.
+       * ipa.c (symtab_remove_unreachable_nodes): Do not remove external
+       nodes at ltrans stage.
+
 2013-06-04  Jan Hubicka  <jh@suse.cz>
 
        * ipa-inline.c (update_caller_keys): Fix availability test.
index 5382b7a8f315f6566ed4861c0f3920dccc9fe067..443d737c44aed43e77aaed5ed879ca9e2a90e1a5 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -387,7 +387,11 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
   for (vnode = varpool_first_variable (); vnode; vnode = vnext)
     {
       vnext = varpool_next_variable (vnode);
-      if (!vnode->symbol.aux)
+      if (!vnode->symbol.aux
+         /* For can_refer_decl_in_current_unit_p we want to track for
+            all external variables if they are defined in other partition
+            or not.  */
+         && (!flag_ltrans || !DECL_EXTERNAL (vnode->symbol.decl)))
        {
          if (file)
            fprintf (file, " %s", varpool_node_name (vnode));
index 6699b8aa2ffdbc7bd007ca51acbdf84d554635f6..065d8480eb95626923a8f69a668166cb30e1cfb8 100644 (file)
@@ -918,7 +918,6 @@ static tree
 get_alias_symbol (tree decl)
 {
   tree alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl));
-  gcc_assert (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)));
   return get_identifier (TREE_STRING_POINTER
                          (TREE_VALUE (TREE_VALUE (alias))));
 }
@@ -1008,7 +1007,8 @@ input_node (struct lto_file_decl_data *file_data,
       node->thunk.virtual_value = virtual_value;
       node->thunk.virtual_offset_p = (type & 4);
     }
-  if (node->symbol.alias && !node->symbol.analyzed)
+  if (node->symbol.alias && !node->symbol.analyzed
+      && lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
     node->symbol.alias_target = get_alias_symbol (node->symbol.decl);
   return node;
 }
@@ -1050,7 +1050,8 @@ input_varpool_node (struct lto_file_decl_data *file_data,
       DECL_EXTERNAL (node->symbol.decl) = 1;
       TREE_STATIC (node->symbol.decl) = 0;
     }
-  if (node->symbol.alias && !node->symbol.analyzed)
+  if (node->symbol.alias && !node->symbol.analyzed
+      && lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl)))
     node->symbol.alias_target = get_alias_symbol (node->symbol.decl);
   ref = streamer_read_hwi (ib);
   /* Store a reference for now, and fix up later to be a pointer.  */