From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 8E97E3836428 for ; Thu, 19 May 2022 15:02:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8E97E3836428 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id C76ED282F1A; Thu, 19 May 2022 17:02:07 +0200 (CEST) Date: Thu, 19 May 2022 17:02:07 +0200 From: Jan Hubicka To: Martin =?iso-8859-2?Q?Li=B9ka?= Cc: gcc-patches@gcc.gnu.org, Martin Jambor Subject: Re: [PATCH] ipa-icf: skip variables with body_removed Message-ID: References: <1cf184b6-a0a1-7514-37e1-ddd8c6b7d7e3@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1cf184b6-a0a1-7514-37e1-ddd8c6b7d7e3@suse.cz> X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: , X-List-Received-Date: Thu, 19 May 2022 15:02:12 -0000 > 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); So the situation here is that we merge symbols but keep syntactic alias because the declarations are not compatible (have different attributes perhaps because of fortify source)? Will ICF still see through the aliases and do merging? I think you can craft a testcase by triggering the attribute mismatch and see what happens. At the time we implemented ICF these aliases did not exists, so maybe some TLC is needed here. Honza