From patchwork Mon Jan 19 15:52:15 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: 430573 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 35F4C14016A for ; Tue, 20 Jan 2015 02:53:58 +1100 (AEDT) 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=KoLx3Bgv1FRXGTxLKbtdTbLZbU7VcE0xNpJciiE752V jD3x+KuBmX0c5qQxPecIAcyXWNUl8yC/WqEflITvmxqN1gtxhqY6YtL6jtpA2667 uFCI6m2Rx1UJJTGIwah4b42skyZxeTjYm+HHNRtJTtwHfTFgjL3u7LMyb+Pi09Hk = 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=YiwtxXB51WO19ht6P1Dhgz8zYP4=; b=Z4NBVhP1WS0kIFwyp +AePKy28o26cysmB+9wZzzCzl4NFOvRL1M075X2i3RJ/A/tdbKundXUORASIDDUG E/Fn0k4uyTKHRm+/GEeCAKyM6t1Prn+f4KTTPmOSYNEGcXMuZ4sF+xhGlc0zpohX ZTp1LVmmpO7toICIYMd0bf+7vM= Received: (qmail 12018 invoked by alias); 19 Jan 2015 15:53:16 -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 11656 invoked by uid 89); 19 Jan 2015 15:52:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 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; Mon, 19 Jan 2015 15:52:19 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A6468AAC5; Mon, 19 Jan 2015 15:52:15 +0000 (UTC) Message-ID: <54BD282F.3030902@suse.cz> Date: Mon, 19 Jan 2015 16:52:15 +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-pat >> GCC Patches" CC: "hubicka@ >> Jan Hubicka" Subject: [PATCH] Fix PR64664 X-IsSubscribed: yes Hello. Following patch correctly handles filtered removed items, where we forgot to check that a cgraph node is deleted or not. Apart from that, logic in the function was rewritten and is much more understandable what's going on. Tested on x86_64-linux-pc. Ready for installation? Thanks, Martin From 3f1d52424d01e7a76b127bf91bdaa04077371d30 Mon Sep 17 00:00:00 2001 From: mliska Date: Mon, 19 Jan 2015 14:28:50 +0100 Subject: [PATCH] Fix PR64664. gcc/ChangeLog: 2015-01-19 Martin Liska * ipa-icf.c (sem_item_optimizer::filter_removed_items): Handle safe potentially removed nodes during filtering. --- gcc/ipa-icf.c | 47 +++++++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 0ac01a9..449d552 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -1652,40 +1652,31 @@ sem_item_optimizer::filter_removed_items (void) { sem_item *item = m_items[i]; - if (item->type == FUNC - && !opt_for_fn (item->decl, flag_ipa_icf_functions)) - { - remove_item (item); - continue; - } - - if (!flag_ipa_icf_variables && item->type == VAR) - { + if (m_removed_items_set.contains (item->node)) + { remove_item (item); continue; - } - - bool no_body_function = false; + } if (item->type == FUNC) - { + { cgraph_node *cnode = static_cast (item)->get_node (); - no_body_function = in_lto_p && (cnode->alias || cnode->body_removed); - } - - if(!m_removed_items_set.contains (m_items[i]->node) - && !no_body_function) - { - if (item->type == VAR || (!DECL_CXX_CONSTRUCTOR_P (item->decl) - && !DECL_CXX_DESTRUCTOR_P (item->decl))) - { - filtered.safe_push (m_items[i]); - continue; - } - } - - remove_item (item); + bool no_body_function = in_lto_p && (cnode->alias || cnode->body_removed); + if (no_body_function || !opt_for_fn (item->decl, flag_ipa_icf_functions) + || DECL_CXX_CONSTRUCTOR_P (item->decl) + || DECL_CXX_DESTRUCTOR_P (item->decl)) + remove_item (item); + else + filtered.safe_push (item); + } + else /* VAR. */ + { + if (!flag_ipa_icf_variables) + remove_item (item); + else + filtered.safe_push (item); + } } /* Clean-up of released semantic items. */ -- 2.1.2