From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 8E613384641C for ; Wed, 24 Apr 2024 22:48:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E613384641C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8E613384641C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713998884; cv=none; b=npO/taJitQ2s3ci7c3zYEUyrQoQL18rJjpjXN4JPZnHmeEAtuZzCbf7ahG8jYY/4ih/shUgzdoBIAq0RQWce6n2Rx98SlXyMteTPNB5lffFwmQqNoCp0uPq/qrYLg6r88nzrndOXaKy3pjN0Ntugruk9f2vd41VZ8byOcyvF/zs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713998884; c=relaxed/simple; bh=tukm0VhJvENSvgpOyVBDgMQn5smpRuu7EtCrPbL/1kI=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=fKUP0s9JIhBYCTWCDtbW3VABnG/sKnLrcPtcQak8ZidjAhAxrIPLiXwAhVo1qpb3ha8eeYp3rmOwLtwJaNB73ifILUeo5JGbRuX2LltOgDonTE6dpnhugFtWOc4VZsWu7HCi/gepDfqAbUtWPwDGBTgGXpHXHRif5xoAWNr+Vtw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713998883; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=sLs8wnNbMTvz+xl+o0RUSxoi5Oqt70SkKZEOaYYG618=; b=Rl3ISuB7WzVWpDDBz1ujseP7gBIsdYtOpEmo8XJ7njlwEsV5P7gq7Jta+ktQEFbiBvVPgg ppw+K60PQaIGL/uWF9bIUq1tw0X4gJGe11k5ez1I1K8Q5lSc0rEmR/LP7dxeVedj65kTqR aeBuN+ErCmxnw73sIvVr0H09K4L1Ifo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-xVRuaSEONteDP8xXcoGDEg-1; Wed, 24 Apr 2024 18:48:01 -0400 X-MC-Unique: xVRuaSEONteDP8xXcoGDEg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 82C561049897; Wed, 24 Apr 2024 22:48:01 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 40723202450D; Wed, 24 Apr 2024 22:48:01 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 43OMlxhb1053958 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 00:47:59 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 43OMlxNV1053957; Thu, 25 Apr 2024 00:47:59 +0200 Date: Thu, 25 Apr 2024 00:47:59 +0200 From: Jakub Jelinek To: Jason Merrill Cc: Jonathan Wakely , Jan Hubicka , gcc-patches@gcc.gnu.org, Richard Biener , Patrick Palka Subject: Re: [PATCH] c++, v3: Retry the aliasing of base/complete cdtor optimization at import_export_decl time [PR113208] Message-ID: Reply-To: Jakub Jelinek References: <5fe9db40-4bff-4be4-a434-6509133f26e3@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: On Wed, Apr 24, 2024 at 06:39:33PM -0400, Jason Merrill wrote: > > --- gcc/cp/decl2.cc.jj 2024-04-23 14:49:41.933186265 +0200 > > +++ gcc/cp/decl2.cc 2024-04-24 15:17:09.043625729 +0200 > > @@ -3314,7 +3314,16 @@ tentative_decl_linkage (tree decl) > > to mark the functions at this point. */ > > if (DECL_DECLARED_INLINE_P (decl) > > && (!DECL_IMPLICIT_INSTANTIATION (decl) > > - || DECL_DEFAULTED_FN (decl))) > > + || DECL_DEFAULTED_FN (decl) > > + /* For implicit instantiations of cdtors, > > + if import_export_decl would use comdat linkage, > > + make sure to use it right away, so that maybe_clone_body > > + can use aliases. See PR113208. */ > > + || (DECL_MAYBE_IN_CHARGE_CDTOR_P (decl) > > + && (flag_implicit_templates > > + || flag_implicit_inline_templates) > > + && flag_weak > > + && TARGET_SUPPORTS_ALIASES))) > > It seems wrong to set DECL_INTERFACE_KNOWN for cdtors that might get an > explicit instantiation later, and likewise for comdat_linkage when > !flag_weak; instead of adding this condition to the if, how about adding an > else like > > > else if (DECL_MAYBE_IN_CHARGE_CDTOR_P (decl)) > > /* For implicit instantiations of cdtors, > > if import_export_decl would use comdat linkage, > > make sure to use it right away, so that maybe_clone_body > > can use aliases. See PR113208. */ > > maybe_make_one_only (decl); > > ? Then can_alias_cdtor would return false, because it ends with: /* Don't use aliases for weak/linkonce definitions unless we can put both symbols in the same COMDAT group. */ return (DECL_INTERFACE_KNOWN (fn) && (SUPPORTS_ONE_ONLY || !DECL_WEAK (fn)) && (!DECL_ONE_ONLY (fn) || (HAVE_COMDAT_GROUP && DECL_WEAK (fn)))); Should we change that DECL_INTERFACE_KNOWN (fn) in there to (DECL_INTERFACE_KNOWN (fn) || something) then and what that something should be? HAVE_COMDAT_GROUP && DECL_ONE_ONLY (fn)? Jakub