OSDN Git Service

PR c++/60046
[pf3gnuchains/gcc-fork.git] / gcc / ipa.c
index 9d54811..8c2b3bd 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -194,14 +194,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
     if (node->analyzed && !node->global.inlined_to
        && (!cgraph_can_remove_if_no_direct_calls_and_refs_p (node)
            /* Keep around virtual functions for possible devirtualization.  */
-           || (before_inlining_p
-               && DECL_VIRTUAL_P (node->decl)
-               && (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl)))
-           /* Also external functions with address taken are better to stay
-              for indirect inlining.  */
-           || (before_inlining_p
-               && DECL_EXTERNAL (node->decl)
-               && node->address_taken)))
+           || (before_inlining_p && DECL_VIRTUAL_P (node->decl))))
       {
         gcc_assert (!node->global.inlined_to);
        enqueue_cgraph_node (node, &first);
@@ -652,7 +645,7 @@ cgraph_externally_visible_p (struct cgraph_node *node,
 
 /* Return true when variable VNODE should be considered externally visible.  */
 
-static bool
+bool
 varpool_externally_visible_p (struct varpool_node *vnode, bool aliased)
 {
   if (!DECL_COMDAT (vnode->decl) && !TREE_PUBLIC (vnode->decl))
@@ -667,6 +660,8 @@ varpool_externally_visible_p (struct varpool_node *vnode, bool aliased)
   if (varpool_used_from_object_file_p (vnode))
     return true;
 
+  if (DECL_HARD_REGISTER (vnode->decl))
+    return true;
   if (DECL_PRESERVE_P (vnode->decl))
     return true;
   if (lookup_attribute ("externally_visible",
@@ -685,6 +680,8 @@ varpool_externally_visible_p (struct varpool_node *vnode, bool aliased)
      This is needed for i.e. references from asm statements.   */
   if (varpool_used_from_object_file_p (vnode))
     return true;
+  if (vnode->resolution == LDPR_PREVAILING_DEF_IRONLY)
+    return false;
 
   /* As a special case, the COMDAT virutal tables can be unshared.
      In LTO mode turn vtables into static variables.  The variable is readonly,