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);
/* 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))
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",
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,