From patchwork Thu May 19 07:08:47 2022 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: 54193 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7CE5B38515DA for ; Thu, 19 May 2022 07:09:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 9B4053851C02 for ; Thu, 19 May 2022 07:08:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9B4053851C02 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 50C6921C2E; Thu, 19 May 2022 07:08:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1652944128; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=K9JT5L6l2+1SWiEM2QjW5BMDG/hizahmKqd2PyZUzY0=; b=isecS1M8iiQV93XJ69sktEIPqqwSgM4fDzpxDyXOxl56TSTkrcGOXi9S5U8mebi4BeHOOA QIDX4bXSg9jaDDkurPEYs056LVZvYI9H0mtjZxkou8YjQx85haYdCwrMJwJFi4KwetUOht K2VFOnqwtgT0DD3s4amzJd5UBPL5W30= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1652944128; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=K9JT5L6l2+1SWiEM2QjW5BMDG/hizahmKqd2PyZUzY0=; b=4FKZPYbI7NXLQn23DsTYbEPUmeRlz9IPpnH4uwC+bKst/sRyLNRRtWg8wAZuKu/Ni9kaq/ eq4dMmjuHo0V66DQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3487113456; Thu, 19 May 2022 07:08:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hCl7CwDthWI+EwAAMHmgww (envelope-from ); Thu, 19 May 2022 07:08:48 +0000 Message-ID: <1cf184b6-a0a1-7514-37e1-ddd8c6b7d7e3@suse.cz> Date: Thu, 19 May 2022 09:08:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] ipa-icf: skip variables with body_removed To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Hubicka Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Similarly to cgraph_nodes, it may happen that body_removed is set during merging of symbols. PR ipa/105600 Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: * ipa-icf.cc (sem_item_optimizer::filter_removed_items): Skip variables with body_removed. --- gcc/ipa-icf.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc index 765ae746745..6528a7a10b2 100644 --- a/gcc/ipa-icf.cc +++ b/gcc/ipa-icf.cc @@ -2411,10 +2411,11 @@ sem_item_optimizer::filter_removed_items (void) { /* Filter out non-readonly variables. */ tree decl = item->decl; - if (TREE_READONLY (decl)) - filtered.safe_push (item); - else + varpool_node *vnode = static_cast (item)->get_node (); + if (!TREE_READONLY (decl) || vnode->body_removed) remove_item (item); + else + filtered.safe_push (item); } } }