This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
More cgraph_remove_unreachable_nodes fixes
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 26 Oct 2010 23:34:39 +0200
- Subject: More cgraph_remove_unreachable_nodes fixes
Hi,
cgraph_remove_unreachable_nodes still remove masters of clones from othr
partitions that confuse sanity checking. Fixed by the following patch that
also cleans up how things are queued. Everything that is referenced by live
part of cgraph is enqueued, everything that is really reachable gets reachable
flag.
Bootstrapped/regtested x86_64-linux, also lto-bootstrapped and comitted.
* ipa.c (process_references): Enqueue all referenced nodes;
mark as reachable only non-external nodes.
(cgraph_remove_unreachable_nodes): All referenced nodes should
be enqueued; remove bogues node->needed check.
Index: ipa.c
===================================================================
--- ipa.c (revision 165985)
+++ ipa.c (working copy)
@@ -170,12 +170,11 @@ process_references (struct ipa_ref_list
{
struct cgraph_node *node = ipa_ref_node (ref);
if (!node->reachable
+ && node->analyzed
&& (!DECL_EXTERNAL (node->decl)
|| before_inlining_p))
- {
- node->reachable = true;
- enqueue_cgraph_node (node, first);
- }
+ node->reachable = true;
+ enqueue_cgraph_node (node, first);
}
else
{
@@ -304,15 +303,15 @@ cgraph_remove_unreachable_nodes (bool be
if (node->reachable)
{
for (e = node->callees; e; e = e->next_callee)
- if (!e->callee->reachable
- && node->analyzed
- && (!e->inline_failed || !e->callee->analyzed
- || (!DECL_EXTERNAL (e->callee->decl))
- || before_inlining_p))
- {
+ {
+ if (!e->callee->reachable
+ && node->analyzed
+ && (!e->inline_failed
+ || !DECL_EXTERNAL (e->callee->decl)
+ || before_inlining_p))
e->callee->reachable = true;
- enqueue_cgraph_node (e->callee, &first);
- }
+ enqueue_cgraph_node (e->callee, &first);
+ }
process_references (&node->ref_list, &first, &first_varpool, before_inlining_p);
}
@@ -416,7 +415,7 @@ cgraph_remove_unreachable_nodes (bool be
found = true;
/* If so, we need to keep node in the callgraph. */
- if (found || node->needed)
+ if (found)
{
if (node->analyzed)
{