From patchwork Sat Feb 28 22:05:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 444675 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E71E01400D5 for ; Sun, 1 Mar 2015 09:05:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=L97mFgVD; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=cGiVq7fNaOx2oEkKIJQyaAMS/UbfC7Un01BWudEQUtZ VPiOsRKhB/e56GtoLW4xU6gBAyN9Ry6fPgfMrRSwGUBx0AuQO10TnF/yWj2fN52A DJ2yD/hMzSVOuxozwzsXN0kyhv5hji0Zpmh/pnqD3GZ/XrzKjoADEf89+vwtSbds = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=06hpYuZcQlXDCVMw7/vLQpVqmxw=; b=L97mFgVDdLk4barMk 0uHOfrNSwaqH81fxtiO9umJmMISc/sJqKigon+WZODyFmiTpp4zqhfb8Pqu/t45M HfXyEAm7VF8w9YWR+SvWA1G5Q/I86hsJd/3I/o/pMxeNIv+rAqfoG1RAJ5By2nJz PylJHCALR5iW1pciu89atNMLAw= Received: (qmail 72261 invoked by alias); 28 Feb 2015 22:05:40 -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 72252 invoked by uid 89); 28 Feb 2015 22:05:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Sat, 28 Feb 2015 22:05:38 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 69C4AABED; Sat, 28 Feb 2015 22:05:34 +0000 (UTC) Message-ID: <54F23BAD.2010304@suse.cz> Date: Sat, 28 Feb 2015 23:05:33 +0100 From: =?UTF-8?B?TWFydGluIExpxaFrYQ==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "gcc- >> GCC Patches" CC: "hubick >> Jan Hubicka" Subject: [PATCH] Fix for PR ipa/65245 X-IsSubscribed: yes Hello. Following patch skips all variable aliases as potential merge candidates. Tested on x86_64-linux. Ready for trunk? Thanks, Martin From fbde2e98f98a71105d18cf3e91e8032d0c657139 Mon Sep 17 00:00:00 2001 From: mliska Date: Fri, 27 Feb 2015 22:42:49 +0100 Subject: [PATCH 2/4] ICF: Do not consider variable aliases for merge operation. gcc/ChangeLog: 2015-02-28 Martin Liska Jan Hubicka PR ipa/65245 * ipa-icf.c (sem_function::parse): Do not consider aliases. (sem_variable::parse): Likewise. (sem_item_optimizer::build_graph): Consider ultimate aliases for references. --- gcc/ipa-icf.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 92133fc..864a5d0 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -1095,7 +1095,7 @@ sem_function::parse (cgraph_node *node, bitmap_obstack *stack) tree fndecl = node->decl; function *func = DECL_STRUCT_FUNCTION (fndecl); - /* TODO: add support for thunks and aliases. */ + /* TODO: add support for thunks. */ if (!func || !node->has_gimple_body_p ()) return NULL; @@ -1407,6 +1407,9 @@ sem_variable::parse (varpool_node *node, bitmap_obstack *stack) { tree decl = node->decl; + if (node->alias) + return NULL; + bool readonly = TYPE_P (decl) ? TYPE_READONLY (decl) : TREE_READONLY (decl); if (!readonly) return NULL; @@ -2057,7 +2060,8 @@ sem_item_optimizer::build_graph (void) cgraph_edge *e = cnode->callees; while (e) { - sem_item **slot = m_symtab_node_map.get (e->callee); + sem_item **slot = m_symtab_node_map.get + (e->callee->ultimate_alias_target ()); if (slot) item->add_reference (*slot); @@ -2068,7 +2072,8 @@ sem_item_optimizer::build_graph (void) ipa_ref *ref = NULL; for (unsigned i = 0; item->node->iterate_reference (i, ref); i++) { - sem_item **slot = m_symtab_node_map.get (ref->referred); + sem_item **slot = m_symtab_node_map.get + (ref->referred->ultimate_alias_target ()); if (slot) item->add_reference (*slot); } -- 2.1.2