From: hubicka Date: Mon, 10 Sep 2012 08:32:36 +0000 (+0000) Subject: * lto-cgraph.c (compute_ltrans_boundary): Do not care about aliases. X-Git-Tag: upstream/4.9.2~10738 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b6f9631381e10d091a88aa675085f10af98a28c6;p=platform%2Fupstream%2Flinaro-gcc.git * lto-cgraph.c (compute_ltrans_boundary): Do not care about aliases. * lto-partition.c (partition_symbol_p): Forward declare. (add_references_to_partition): Reimplement using partition_symbol_p. (add_aliases_to_partition): Break out from add_references_to_partition; reimplement using partition_symbol_p. (add_cgraph_node_to_partition_1): Handle callees using partition_symbol_p; add sanity checks. (add_varpool_node_to_partition): Use add_aliases_to_partition. (partition_varpool_node_p): Do not special case aliases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191129 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec97f3a..0a43ed8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-09-10 Jan Hubicka + + * lto-cgraph.c (compute_ltrans_boundary): Do not care about aliases. + * symtab.c (symtab_make_decl_local): Remove user defined visibility + when making symbol local. + 2012-09-09 Mark Kettenis * config/openbsd-stdint.h (INTMAX_TYPE, UINTMAX_TYPE): Define. diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 300e571..6223d1a 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -730,8 +730,6 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) lto_set_symtab_encoder_encode_initializer (encoder, vnode); add_references (encoder, &vnode->symbol.ref_list); } - else if (vnode->alias || vnode->alias_of) - add_references (encoder, &vnode->symbol.ref_list); } } diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 51965c7..b7a9de5 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,14 @@ +2012-09-10 Jan Hubicka + + * lto-partition.c (partition_symbol_p): Forward declare. + (add_references_to_partition): Reimplement using partition_symbol_p. + (add_aliases_to_partition): Break out from add_references_to_partition; + reimplement using partition_symbol_p. + (add_cgraph_node_to_partition_1): Handle callees using partition_symbol_p; + add sanity checks. + (add_varpool_node_to_partition): Use add_aliases_to_partition. + (partition_varpool_node_p): Do not special case aliases. + 2012-08-12 Jan Hubicka * lto.c (lto_wpa_write_files): Do not delete partition encoder; diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index 8ec2889..4775ee6 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -35,6 +35,7 @@ VEC(ltrans_partition, heap) *ltrans_partitions; static void add_cgraph_node_to_partition (ltrans_partition part, struct cgraph_node *node); static void add_varpool_node_to_partition (ltrans_partition part, struct varpool_node *vnode); +static bool partition_symbol_p (symtab_node node); /* Create new partition with name NAME. */ static ltrans_partition @@ -62,8 +63,8 @@ free_ltrans_partitions (void) VEC_free (ltrans_partition, heap, ltrans_partitions); } -/* See all references that go to comdat objects and bring them into partition too. - Also see all aliases of the newly added entry and bring them, too. */ +/* Add all referenced symbols referenced by REFS that are not external and not + partitioned into PART. */ static void add_references_to_partition (ltrans_partition part, struct ipa_ref_list *refs) { @@ -71,46 +72,38 @@ add_references_to_partition (ltrans_partition part, struct ipa_ref_list *refs) struct ipa_ref *ref; for (i = 0; ipa_ref_list_reference_iterate (refs, i, ref); i++) { - if (symtab_function_p (ref->referred) - && (DECL_COMDAT (cgraph_function_node (ipa_ref_node (ref), - NULL)->symbol.decl) - || (ref->use == IPA_REF_ALIAS - && lookup_attribute - ("weakref", DECL_ATTRIBUTES (ref->referred->symbol.decl)))) - && !lto_symtab_encoder_in_partition_p (part->encoder, ref->referred)) + if (DECL_EXTERNAL (ref->referred->symbol.decl) + || partition_symbol_p (ref->referred) + || lto_symtab_encoder_in_partition_p (part->encoder, ref->referred)) + continue; + if (symtab_function_p (ref->referred)) add_cgraph_node_to_partition (part, ipa_ref_node (ref)); else - if (symtab_variable_p (ref->referred) - && (DECL_COMDAT (ref->referred->symbol.decl) - || DECL_EXTERNAL (ref->referred->symbol.decl) - || (ref->use == IPA_REF_ALIAS - && lookup_attribute - ("weakref", - DECL_ATTRIBUTES (ref->referred->symbol.decl)))) - && !lto_symtab_encoder_in_partition_p (part->encoder, ref->referred)) - add_varpool_node_to_partition (part, ipa_ref_varpool_node (ref)); + add_varpool_node_to_partition (part, ipa_ref_varpool_node (ref)); } +} + +/* Look for all (nonweakref) aliases in REFS and add them into PART. */ +static void +add_aliases_to_partition (ltrans_partition part, struct ipa_ref_list *refs) +{ + int i; + struct ipa_ref *ref; + for (i = 0; ipa_ref_list_referring_iterate (refs, i, ref); i++) - { - if (symtab_function_p (ref->referring) - && ref->use == IPA_REF_ALIAS - && !lto_symtab_encoder_in_partition_p (part->encoder, - ref->referring) - && !lookup_attribute ("weakref", - DECL_ATTRIBUTES - (ref->referring->symbol.decl))) - add_cgraph_node_to_partition (part, ipa_ref_referring_node (ref)); - else - if (symtab_variable_p (ref->referring) - && ref->use == IPA_REF_ALIAS - && !lto_symtab_encoder_in_partition_p (part->encoder, - ref->referring) - && !lookup_attribute ("weakref", - DECL_ATTRIBUTES - (ref->referring->symbol.decl))) + if (ref->use == IPA_REF_ALIAS + && !lto_symtab_encoder_in_partition_p (part->encoder, + ref->referring) + && !lookup_attribute ("weakref", + DECL_ATTRIBUTES + (ref->referring->symbol.decl))) + { + if (symtab_function_p (ref->referring)) + add_cgraph_node_to_partition (part, ipa_ref_referring_node (ref)); + else add_varpool_node_to_partition (part, ipa_ref_referring_varpool_node (ref)); - } + } } /* Worker for add_cgraph_node_to_partition. */ @@ -120,6 +113,9 @@ add_cgraph_node_to_partition_1 (struct cgraph_node *node, void *data) { ltrans_partition part = (ltrans_partition) data; + if (lto_symtab_encoder_in_partition_p (part->encoder, (symtab_node) node)) + return false; + /* non-COMDAT aliases of COMDAT functions needs to be output just once. */ if (!DECL_COMDAT (node->symbol.decl) && !node->global.inlined_to @@ -157,12 +153,10 @@ add_cgraph_node_to_partition (ltrans_partition part, struct cgraph_node *node) part->insns += inline_summary (node)->self_size; - - lto_set_symtab_encoder_in_partition (part->encoder, (symtab_node) node); - for (e = node->callees; e; e = e->next_callee) if ((!e->inline_failed - || DECL_COMDAT (cgraph_function_node (e->callee, NULL)->symbol.decl))) + || (!DECL_EXTERNAL (e->callee->symbol.decl) + && !partition_symbol_p ((symtab_node) e->callee)))) add_cgraph_node_to_partition (part, e->callee); /* The only way to assemble non-weakref alias is to add the aliased object into @@ -211,6 +205,7 @@ add_varpool_node_to_partition (ltrans_partition part, struct varpool_node *vnode add_varpool_node_to_partition (part, v); add_references_to_partition (part, &vnode->symbol.ref_list); + add_aliases_to_partition (part, &vnode->symbol.ref_list); if (vnode->symbol.same_comdat_group && !lto_symtab_encoder_in_partition_p (part->encoder, @@ -266,7 +261,7 @@ partition_cgraph_node_p (struct cgraph_node *node) static bool partition_varpool_node_p (struct varpool_node *vnode) { - if (vnode->alias || !vnode->analyzed) + if (!vnode->analyzed) return false; /* Constant pool and comdat are always only in partitions they are needed. */ if (DECL_IN_CONSTANT_POOL (vnode->symbol.decl) diff --git a/gcc/symtab.c b/gcc/symtab.c index 665ceae..1dceb79 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -734,6 +734,8 @@ symtab_make_decl_local (tree decl) DECL_WEAK (decl) = 0; DECL_EXTERNAL (decl) = 0; TREE_PUBLIC (decl) = 0; + DECL_VISIBILITY_SPECIFIED (decl) = 0; + DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT; if (!DECL_RTL_SET_P (decl)) return;