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 1EBAF3858425 for ; Fri, 13 Jan 2023 16:49:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1EBAF3858425 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 C1E291FFBC; Fri, 13 Jan 2023 16:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1673628576; 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=aXKL6JC/JyMEkW4NaEO04yH+RlFeZx+inHGLV0xje0w=; b=1ubiQKj3Lj2n8R8CXKeLAVtQbuoGZk7E0ppcY/LKaJ8wBoNZPiimXjxnIEpOLTSFHqgod2 dZpBxBBtkyB6yNqdO/UWqLNPwM6A4taYpuxTa90gqsIo6ZL7pC+AjxP1glWpwPvJ35DypH ROpCNiFG3gW/ZI2U/0wM3unOnUl0YsM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1673628576; 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=aXKL6JC/JyMEkW4NaEO04yH+RlFeZx+inHGLV0xje0w=; b=bpeq3CbTwKtgVTieyJckX9ug/46givky+3DxIlKV7hRiCBqonRD8y8y3M/s5ueuVOMFDHl yEPYYMc/aoVdVOCA== 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 B4CF713918; Fri, 13 Jan 2023 16:49:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 93WFK6CLwWPeYAAAMHmgww (envelope-from ); Fri, 13 Jan 2023 16:49:36 +0000 From: Martin Jambor To: Martin =?utf-8?Q?Li=C5=A1ka?= , gcc-patches@gcc.gnu.org Cc: Subject: Re: [PATCH] IPA: do not release body if still needed In-Reply-To: References: User-Agent: Notmuch/0.37 (https://notmuchmail.org) Emacs/28.2 (x86_64-suse-linux-gnu) Date: Fri, 13 Jan 2023 17:49:36 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.8 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, sorry for getting to this so late. On Thu, Dec 01 2022, Martin Li=C5=A1ka wrote: > Hi. > > Noticed during building of libbackend.a with the LTO partial linking. The testcase is areally nice one, too bad it's probably impossible to get it small enough to be included in the testcase. But it also fails to fail for me on trunk, I could only reproduce the problem on the gcc-12 branch. > > The function release_body is called even if clone_of is a clone > of a another function and thus it shares tree declaration. We should > preserve it in that situation. > But then PR 100413 could happen just one level higher in the clones hierarchy, not for clone_of but for clone_of->clone_of, no? I think we need something like the following (only lightly tested so far, I'll bootstrap it over the weekend): diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index 4bb9e7ba6af..3734c85db63 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -1895,8 +1895,18 @@ cgraph_node::remove (void) else if (clone_of) { clone_of->clones =3D next_sibling_clone; - if (!clone_of->analyzed && !clone_of->clones && !clones) - clone_of->release_body (); + if (!clones) + { + bool need_body =3D false; + for (cgraph_node *n =3D clone_of; n; n =3D n->clone_of) + if (n->analyzed || n->clones) + { + need_body =3D true; + break; + } + if (!need_body) + clone_of->release_body (); + } } if (next_sibling_clone) next_sibling_clone->prev_sibling_clone =3D prev_sibling_clone; Thanks for catching this. Martin