From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 99E1C3857820 for ; Fri, 20 May 2022 07:46:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 99E1C3857820 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-out2.suse.de (Postfix) with ESMTPS id 6E5821FD62; Fri, 20 May 2022 07:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1653032793; 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: in-reply-to:in-reply-to:references:references; bh=Ye/Sw14BpmpaA0Xi9cr4lXBIBrGxDCdwGpGAho3xGfU=; b=UDmhxsKxAch3EmmJsJ1oQgiGht+xL0BCWYQ2StLqnPscmUR2eQ0E6LKE3ZIt6C11fBrtA/ wQroXfBYdmezwhLRFXVaBn+gCZqm9pNrJXrigIo0M+3e4We/4sK1Gp3x56kcB6WxisjF1M DRT+seBzIWUBSRcu2wf3tz9dF1WETAo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1653032793; 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: in-reply-to:in-reply-to:references:references; bh=Ye/Sw14BpmpaA0Xi9cr4lXBIBrGxDCdwGpGAho3xGfU=; b=+zSYkrxtIi9dBOonaVE9bXfBJjCsBLK3uTIooh8A5xzeEzRNO++SwNtUXjO0io4g8S/60C 9tizHJ3POoJVYTCg== 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 8908B13AF4; Fri, 20 May 2022 07:46:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uod2IFhHh2J4OwAAMHmgww (envelope-from ); Fri, 20 May 2022 07:46:32 +0000 Message-ID: Date: Fri, 20 May 2022 09:46:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] ipa-icf: skip variables with body_removed Content-Language: en-US To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org, Martin Jambor References: <1cf184b6-a0a1-7514-37e1-ddd8c6b7d7e3@suse.cz> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, 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: , X-List-Received-Date: Fri, 20 May 2022 07:46:36 -0000 On 5/19/22 17:02, Jan Hubicka wrote: >> 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)? The test-case is more about a constexpr symbol or so, I'm not familiar enough with these modern C++. cgraph_node looks like: (gdb) p item->node->debug() _ZN8nlohmann6detail12static_constINS0_10to_json_fnEE5valueE/10 (value) @0x7ffff7fb3200 Type: variable Body removed by symtab_remove_unreachable_nodes Visibility: externally_visible semantic_interposition preempted_reg external public weak comdat comdat_group:_ZN8nlohmann6detail12static_constINS0_10to_json_fnEE5valueE one_only References: Referring: _Z7to_jsonRN8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmiSaNS_14adl_serializerES2_IhSaIhEEEERK8Settings/1 (addr) _Z7to_jsonRN8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmiSaNS_14adl_serializerES2_IhSaIhEEEERK8Settings/1 (addr) Read from file: a.o Availability: not_available Varpool flags: initialized read-only > > Will ICF still see through the aliases and do merging? No. > 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. Please come up with such test case :) Thanks, Martin > > Honza