From patchwork Tue Apr 9 22:46:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 235256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 4BF632C00AA for ; Wed, 10 Apr 2013 08:46:55 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=FI6q/04tvrDic8EWjlQt5P1LKvnTHxjfVTH1wXpPRwF9L23L2e+iZ Sla1xORWJEhERUY+7ys4einMAiJX9QSCuJrK2rllQi7b0j+NPkBoNHOv7KGmwGAr +WyPRh4EMx2hBltciZwiyzW4BKUNhhuG70Y3aCAXUZoWUaFDOs1ats= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=/t6w/5gOaPHB50Ex8Sj3LpsYMt0=; b=CAt611HdtcWx6DJ7BEQe EFuZJ/76CXsZ8TqOho+6uZ3hSmOJn8Q+n9vwUgVwFcttpZ7ktC1EPnbP76MR0sTo a3DqS8eUk+PVSOnh8lNzsEycRiD1dwS92AtQ9NsHj3tf/0zZ/aaOoGgcfW6epWLi oljJS/b+nJgbE/chmLLBgw0= Received: (qmail 5376 invoked by alias); 9 Apr 2013 22:46:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 5364 invoked by uid 89); 9 Apr 2013 22:46:48 -0000 X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_00, KAM_STOCKTIP, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD autolearn=no version=3.3.1 Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 09 Apr 2013 22:46:46 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 18CC9540D55; Wed, 10 Apr 2013 00:46:44 +0200 (CEST) Date: Wed, 10 Apr 2013 00:46:44 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Drop more of the old alias handling code Message-ID: <20130409224643.GC24359@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Hi, this patch removes handling of alias pairs in ipa.c. This code is no longer needed now when we represent all aliases explicitly in the symbol table. Bootstrapped/regtested x86_64-linux. Honza * ipa.c (cgraph_externally_visible_p, varpool_externally_visible_p): Drop aliased parameter. (function_and_variable_visibility): Do not handle alias pairs. * cgraph.c (varpool_externally_visible_p): Update prototype. * varpool.c (varpool_add_new_variable): Update. Index: ipa.c =================================================================== --- ipa.c (revision 197243) +++ ipa.c (working copy) @@ -573,7 +573,7 @@ cgraph_comdat_can_be_unshared_p (struct static bool cgraph_externally_visible_p (struct cgraph_node *node, - bool whole_program, bool aliased) + bool whole_program) { if (!node->local.finalized) return false; @@ -582,11 +582,6 @@ cgraph_externally_visible_p (struct cgra || DECL_EXTERNAL (node->symbol.decl))) return false; - /* Do not even try to be smart about aliased nodes. Until we properly - represent everything by same body alias, these are just evil. */ - if (aliased) - return true; - /* Do not try to localize built-in functions yet. One of problems is that we end up mangling their asm for WHOPR that makes it impossible to call them using the implicit built-in declarations anymore. Similarly this enables @@ -638,7 +633,7 @@ cgraph_externally_visible_p (struct cgra /* Return true when variable VNODE should be considered externally visible. */ bool -varpool_externally_visible_p (struct varpool_node *vnode, bool aliased) +varpool_externally_visible_p (struct varpool_node *vnode) { /* Do not touch weakrefs; while they are not externally visible, dropping their DECL_EXTERNAL flags confuse most @@ -652,11 +647,6 @@ varpool_externally_visible_p (struct var if (!DECL_COMDAT (vnode->symbol.decl) && !TREE_PUBLIC (vnode->symbol.decl)) return false; - /* Do not even try to be smart about aliased nodes. Until we properly - represent everything by same body alias, these are just evil. */ - if (aliased) - return true; - /* If linker counts on us, we must preserve the function. */ if (symtab_used_from_object_file_p ((symtab_node) vnode)) return true; @@ -733,42 +723,9 @@ function_and_variable_visibility (bool w { struct cgraph_node *node; struct varpool_node *vnode; - struct pointer_set_t *aliased_nodes = pointer_set_create (); - struct pointer_set_t *aliased_vnodes = pointer_set_create (); - unsigned i; - alias_pair *p; - /* Discover aliased nodes. */ - FOR_EACH_VEC_SAFE_ELT (alias_pairs, i, p) - { - if (dump_file) - fprintf (dump_file, "Alias %s->%s", - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (p->decl)), - IDENTIFIER_POINTER (p->target)); - - if ((node = cgraph_node_for_asm (p->target)) != NULL - && !DECL_EXTERNAL (node->symbol.decl)) - { - if (!node->analyzed) - continue; - cgraph_mark_force_output_node (node); - pointer_set_insert (aliased_nodes, node); - if (dump_file) - fprintf (dump_file, " node %s/%i", - cgraph_node_name (node), node->uid); - } - else if ((vnode = varpool_node_for_asm (p->target)) != NULL - && !DECL_EXTERNAL (vnode->symbol.decl)) - { - vnode->symbol.force_output = 1; - pointer_set_insert (aliased_vnodes, vnode); - if (dump_file) - fprintf (dump_file, " varpool node %s", - varpool_node_name (vnode)); - } - if (dump_file) - fprintf (dump_file, "\n"); - } + /* All aliases should be procssed at this point. */ + gcc_checking_assert (!alias_pairs || !alias_pairs->length()); FOR_EACH_FUNCTION (node) { @@ -817,9 +774,7 @@ function_and_variable_visibility (bool w && !DECL_COMDAT (node->symbol.decl)) || TREE_PUBLIC (node->symbol.decl) || DECL_EXTERNAL (node->symbol.decl)); - if (cgraph_externally_visible_p (node, whole_program, - pointer_set_contains (aliased_nodes, - node))) + if (cgraph_externally_visible_p (node, whole_program)) { gcc_assert (!node->global.inlined_to); node->symbol.externally_visible = true; @@ -898,9 +853,7 @@ function_and_variable_visibility (bool w { if (!vnode->finalized) continue; - if (varpool_externally_visible_p - (vnode, - pointer_set_contains (aliased_vnodes, vnode))) + if (varpool_externally_visible_p (vnode)) vnode->symbol.externally_visible = true; else vnode->symbol.externally_visible = false; @@ -913,8 +866,6 @@ function_and_variable_visibility (bool w vnode->symbol.resolution = LDPR_PREVAILING_DEF_IRONLY; } } - pointer_set_destroy (aliased_nodes); - pointer_set_destroy (aliased_vnodes); if (dump_file) { Index: cgraph.h =================================================================== --- cgraph.h (revision 197242) +++ cgraph.h (working copy) @@ -726,7 +726,7 @@ void debug_varpool_node_set (varpool_nod void free_varpool_node_set (varpool_node_set); void ipa_discover_readonly_nonaddressable_vars (void); bool cgraph_comdat_can_be_unshared_p (struct cgraph_node *); -bool varpool_externally_visible_p (struct varpool_node *, bool); +bool varpool_externally_visible_p (struct varpool_node *); /* In predict.c */ bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e); Index: varpool.c =================================================================== --- varpool.c (revision 197242) +++ varpool.c (working copy) @@ -191,7 +191,7 @@ varpool_add_new_variable (tree decl) struct varpool_node *node; varpool_finalize_decl (decl); node = varpool_node_for_decl (decl); - if (varpool_externally_visible_p (node, false)) + if (varpool_externally_visible_p (node)) node->symbol.externally_visible = true; }