From c0c123ef5222b0e12a5984640f0dd4db4ada569c Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 1 Aug 2013 15:24:49 +0200 Subject: cgraph.c (cgraph_release_function_body): Use used_as_abstract_origin. * cgraph.c (cgraph_release_function_body): Use used_as_abstract_origin. (cgraph_release_function_body): Likewise. (cgraph_can_remove_if_no_direct_calls_p): Likewise. * cgraph.h (cgrpah_node): Rename abstract_and_needed to used_as_abstract_origin. * tree-inline-transfrom.c (can_remove_node_now_p_1): Do not remove symbols used as abstract origins. * cgraphunit.c (analyze_functions): Update. * ipa.c (symtab_remove_unreachable_nodes): Recompute used_as_abstract_origin. * tree-inline.c (tree_function_versioning): Update used_as_abstract_origin; be ready for DECL_RESULT and DECL_ARGUMENTS to be NULL. * lto-symtab.c (lto_symtab_merge_symbols): Merge duplicated nodes for abstract functions. * cgraph.h (symtab_real_symbol_p): Abstract declarations are not real symbols. From-SVN: r201408 --- gcc/ipa.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'gcc/ipa.c') diff --git a/gcc/ipa.c b/gcc/ipa.c index e20e561..243bf20 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -234,20 +234,23 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) This is mostly when they can be referenced externally. Inline clones are special since their declarations are shared with master clone and thus cgraph_can_remove_if_no_direct_calls_and_refs_p should not be called on them. */ - FOR_EACH_DEFINED_FUNCTION (node) - if (!node->global.inlined_to - && !node->symbol.in_other_partition - && (!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->symbol.decl)))) - { - gcc_assert (!node->global.inlined_to); - pointer_set_insert (reachable, node); - enqueue_node ((symtab_node)node, &first, reachable); - } - else - gcc_assert (!node->symbol.aux); + FOR_EACH_FUNCTION (node) + { + node->used_as_abstract_origin = false; + if (node->symbol.definition + && !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->symbol.decl)))) + { + gcc_assert (!node->global.inlined_to); + pointer_set_insert (reachable, node); + enqueue_node ((symtab_node)node, &first, reachable); + } + else + gcc_assert (!node->symbol.aux); + } /* Mark variables that are obviously needed. */ FOR_EACH_DEFINED_VARIABLE (vnode) @@ -272,6 +275,13 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) node->symbol.aux = (void *)2; else { + if (DECL_ABSTRACT_ORIGIN (node->symbol.decl)) + { + struct cgraph_node *origin_node + = cgraph_get_create_real_symbol_node (DECL_ABSTRACT_ORIGIN (node->symbol.decl)); + origin_node->used_as_abstract_origin = true; + enqueue_node ((symtab_node) origin_node, &first, reachable); + } /* If any symbol in a comdat group is reachable, force all other in the same comdat group to be also reachable. */ if (node->symbol.same_comdat_group) -- cgit v1.1