From bd3cdcc0872c2ce75d82ecc5a426cb3ace641d0f Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 13 May 2010 08:13:46 +0200 Subject: cgraph.c (cgraph_mark_address_taken_node): No longer imply needed flag. * cgraph.c (cgraph_mark_address_taken_node): No longer imply needed flag. * cgraph.h (cgraph_only_called_directly_p, cgraph_can_remove_if_no_direct_calls_p): test address_taken flag. (cgraph_can_remove_if_no_direct_calls_and_refs_p): New function. * cgraphunit.c (cgraph_mark_functions_to_output): Test address_taken. (assemble * ipa.c (cgraph_remove_unreachable_nodes): Use cgraph_can_remove_if_no_direct_calls_and_refs_p; clear address_taken flags. * tree-inline.c (copy_bb): Check address_taken flag. * tree-profile.c (tree_gen_ic_func_profiler): Check address_taken and externally_visible flag. * tree-ssa/unreachable.c: New test. From-SVN: r159354 --- gcc/ipa.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'gcc/ipa.c') diff --git a/gcc/ipa.c b/gcc/ipa.c index 1fc3fdd..2512177 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -207,7 +207,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) #endif varpool_reset_queue (); for (node = cgraph_nodes; node; node = node->next) - if (!cgraph_can_remove_if_no_direct_calls_p (node) + if (!cgraph_can_remove_if_no_direct_calls_and_refs_p (node) && ((!DECL_EXTERNAL (node->decl)) || before_inlining_p)) { @@ -405,6 +405,25 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) varpool_remove_node (vnode); } } + if (file) + fprintf (file, "\nClearing address taken flags:"); + for (node = cgraph_nodes; node; node = node->next) + if (node->address_taken + && !node->reachable_from_other_partition) + { + int i; + struct ipa_ref *ref; + bool found = false; + for (i = 0; ipa_ref_list_refering_iterate (&node->ref_list, i, ref) + && !found; i++) + found = true; + if (!found) + { + if (file) + fprintf (file, " %s", cgraph_node_name (node)); + node->address_taken = false; + } + } #ifdef ENABLE_CHECKING verify_cgraph (); -- cgit v1.1