ipa.c (cgraph_remove_unreachable_nodes): External references can always be removed.
* ipa.c (cgraph_remove_unreachable_nodes): External references can always be removed. (cgraph_externally_visible_p): We can not bring local comdats that are known to linker; fix handling of internal visibility. (function_and_variable_visibility): Likewise. From-SVN: r165057
This commit is contained in:
parent
8cfaf4c938
commit
0e9ea52bfc
|
@ -1,3 +1,11 @@
|
||||||
|
2010-10-06 Jan Hubicka <jh@suse.cz>
|
||||||
|
|
||||||
|
* ipa.c (cgraph_remove_unreachable_nodes): External references can always
|
||||||
|
be removed.
|
||||||
|
(cgraph_externally_visible_p): We can not bring local comdats that are known
|
||||||
|
to linker; fix handling of internal visibility.
|
||||||
|
(function_and_variable_visibility): Likewise.
|
||||||
|
|
||||||
2010-10-06 Eric Botcazou <ebotcazou@adacore.com>
|
2010-10-06 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
PR rtl-optimization/45394
|
PR rtl-optimization/45394
|
||||||
|
|
33
gcc/ipa.c
33
gcc/ipa.c
|
@ -238,14 +238,19 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
|
||||||
#endif
|
#endif
|
||||||
varpool_reset_queue ();
|
varpool_reset_queue ();
|
||||||
for (node = cgraph_nodes; node; node = node->next)
|
for (node = cgraph_nodes; node; node = node->next)
|
||||||
if ((!cgraph_can_remove_if_no_direct_calls_and_refs_p (node)
|
if (!node->analyzed)
|
||||||
/* Keep around virtual functions for possible devirtualization. */
|
{
|
||||||
|| (!before_inlining_p
|
gcc_assert (!node->aux);
|
||||||
&& !node->global.inlined_to
|
node->reachable = false;
|
||||||
&& DECL_VIRTUAL_P (node->decl)
|
}
|
||||||
&& (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl))))
|
else if ((!cgraph_can_remove_if_no_direct_calls_and_refs_p (node)
|
||||||
&& ((!DECL_EXTERNAL (node->decl))
|
/* Keep around virtual functions for possible devirtualization. */
|
||||||
|| before_inlining_p))
|
|| (!before_inlining_p
|
||||||
|
&& !node->global.inlined_to
|
||||||
|
&& DECL_VIRTUAL_P (node->decl)
|
||||||
|
&& (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl))))
|
||||||
|
&& ((!DECL_EXTERNAL (node->decl))
|
||||||
|
|| before_inlining_p))
|
||||||
{
|
{
|
||||||
gcc_assert (!node->global.inlined_to);
|
gcc_assert (!node->global.inlined_to);
|
||||||
enqueue_cgraph_node (node, &first);
|
enqueue_cgraph_node (node, &first);
|
||||||
|
@ -592,8 +597,13 @@ cgraph_externally_visible_p (struct cgraph_node *node, bool whole_program, bool
|
||||||
if (aliased)
|
if (aliased)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
/* If linker counts on us, we must preserve the function. */
|
||||||
|
if (cgraph_used_from_object_file_p (node))
|
||||||
|
return true;
|
||||||
/* When doing link time optimizations, hidden symbols become local. */
|
/* When doing link time optimizations, hidden symbols become local. */
|
||||||
if (in_lto_p && DECL_VISIBILITY (node->decl) == VISIBILITY_HIDDEN
|
if (in_lto_p
|
||||||
|
&& (DECL_VISIBILITY (node->decl) == VISIBILITY_HIDDEN
|
||||||
|
|| DECL_VISIBILITY (node->decl) == VISIBILITY_INTERNAL)
|
||||||
/* Be sure that node is defined in IR file, not in other object
|
/* Be sure that node is defined in IR file, not in other object
|
||||||
file. In that case we don't set used_from_other_object_file. */
|
file. In that case we don't set used_from_other_object_file. */
|
||||||
&& node->analyzed)
|
&& node->analyzed)
|
||||||
|
@ -621,8 +631,6 @@ cgraph_externally_visible_p (struct cgraph_node *node, bool whole_program, bool
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cgraph_used_from_object_file_p (node))
|
|
||||||
return true;
|
|
||||||
if (DECL_PRESERVE_P (node->decl))
|
if (DECL_PRESERVE_P (node->decl))
|
||||||
return true;
|
return true;
|
||||||
if (MAIN_NAME_P (DECL_NAME (node->decl)))
|
if (MAIN_NAME_P (DECL_NAME (node->decl)))
|
||||||
|
@ -794,7 +802,8 @@ function_and_variable_visibility (bool whole_program)
|
||||||
/* When doing linktime optimizations, all hidden symbols will
|
/* When doing linktime optimizations, all hidden symbols will
|
||||||
become local. */
|
become local. */
|
||||||
&& (!in_lto_p
|
&& (!in_lto_p
|
||||||
|| DECL_VISIBILITY (vnode->decl) != VISIBILITY_HIDDEN
|
|| (DECL_VISIBILITY (vnode->decl) != VISIBILITY_HIDDEN
|
||||||
|
&& DECL_VISIBILITY (vnode->decl) != VISIBILITY_INTERNAL)
|
||||||
/* We can get prevailing decision in other object file.
|
/* We can get prevailing decision in other object file.
|
||||||
In this case we do not sed used_from_object_file. */
|
In this case we do not sed used_from_object_file. */
|
||||||
|| !vnode->finalized))
|
|| !vnode->finalized))
|
||||||
|
|
Loading…
Reference in New Issue