OSDN Git Service

2012-09-07 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Sep 2012 13:05:18 +0000 (13:05 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Sep 2012 13:05:18 +0000 (13:05 +0000)
Backport from mainline
2012-06-26  Jan Hubicka  <jh@suse.cz>

PR lto/53572
* cgraph.h (varpool_can_remove_if_no_refs): Fix handling of
used symbols.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@191073 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cgraph.h

index f4bbc80..498ff5a 100644 (file)
@@ -1,6 +1,15 @@
 2012-09-07  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
+       2012-06-26  Jan Hubicka  <jh@suse.cz>
+
+       PR lto/53572
+       * cgraph.h (varpool_can_remove_if_no_refs): Fix handling of
+       used symbols.
+
+2012-09-07  Richard Guenther  <rguenther@suse.de>
+
+       Backport from mainline
        2012-07-13  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/53922
index 191364c..dfdafd8 100644 (file)
@@ -946,10 +946,13 @@ cgraph_only_called_directly_or_aliased_p (struct cgraph_node *node)
 static inline bool
 varpool_can_remove_if_no_refs (struct varpool_node *node)
 {
+  if (DECL_EXTERNAL (node->decl))
+    return true;
   return (!node->force_output && !node->used_from_other_partition
-         && (flag_toplevel_reorder || DECL_COMDAT (node->decl)
-             || DECL_ARTIFICIAL (node->decl))
-         && (DECL_COMDAT (node->decl) || !node->externally_visible));
+         && ((DECL_COMDAT (node->decl)
+              && !varpool_used_from_object_file_p (node))
+             || !node->externally_visible
+             || DECL_HAS_VALUE_EXPR_P (node->decl)));
 }
 
 /* Return true when all references to VNODE must be visible in ipa_ref_list.