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 6C463384640E for ; Thu, 25 Apr 2024 00:43:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C463384640E 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 6C463384640E 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=1714005833; cv=none; b=DiVuuh23PA8YcvxB5cLad+v+0n0cfEDxoV+d5QsW5lgsB1W2lfHhi94SZkNzXRLvnBH7HvyS2xsA3meSa1dqFrzfoUUZDied8jlxZB9N2uYIpPUFmdNmNZtLe+vRlw55ei84QqvVqyFus3fPDBUy/hRaGq1nNPDOz1bGOnTkt5Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714005833; c=relaxed/simple; bh=KhTDrRgAdDxaqrPa5RR10Jsbt9DO7kP1L89xiDH8+6E=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=IBpGVDX0/IfezYzTAxlGvMzMxAMwSgNP4OJwA81iXit9akY0TPIXyTO5pLpUhOnk+3av+703xXdw6+KAlH1WsZG52T5iyOO/jV+Ppq3x8TwW6BQxuyRb+mRDNGvkT+mH9c+jLeeERWjzQB/oqYcCsVXRFZabHIM6tL5a0orseic= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714005832; h=from:from:reply-to:subject:subject: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=D+tn61151kkUHfaoM0vF1EndaYkiGrzhS177Vjktf30=; b=eJJhyyf8MCbvx923+jhBvCULRhpGZMB7xwUyAY/3vWTjnZjo4tq3jAlJ40LOaQdafNbYx3 O/JeZZ5B5sYpBJBZV+17/HLtL7zDt3V6GoGttXWqBtXHU83jzXPMJby6KL0SveEvAdHiwe d+pJfqh62hH2toKawfxPgNTHqhXTIug= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-CCbqpNFHOL6DGn5oWZKmRg-1; Wed, 24 Apr 2024 20:43:48 -0400 X-MC-Unique: CCbqpNFHOL6DGn5oWZKmRg-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4393e712cd5so5025961cf.3 for ; Wed, 24 Apr 2024 17:43:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714005828; x=1714610628; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=D+tn61151kkUHfaoM0vF1EndaYkiGrzhS177Vjktf30=; b=nF/SmpXuDji/hpcmuX/sVoFUucB8F5LN3wnHv3chX8atKqQ9zsfKD/KGNpzOLyRbsl y7eXHSHptTVNQr18K+CQ9zgvK93OdJXIaMQDSSj7pj378+vTWwPkZ2Vz/Uc34LNZ3dNf C6HqKvjAvrI6FZCJipHkv87v4KicSj5by0z1h0h/LSeoI1zQ6txxoh83lYfJs6IwHcng iurgjSDug+pkUe5rqjcAc3xE0ItM74TjaFkjGgcXe8PXGndl9KvbR7NQmbY+R/yt7gUB 8LmYNA6kMzJHCObIo4/EldBK3dvBmPr3tdAwp9dvQG/z9H1YBjlZkxvzFTv+yFKrgKtZ /jig== X-Forwarded-Encrypted: i=1; AJvYcCXUo//qpkK9fEIL6w//RRoxmY4JewsBDh/J4y6IwXvYB/3VLcVButTrZUTxGXbjAV5u9nyITG+fVNDzodZEIKbJ0XCNyKeJmw== X-Gm-Message-State: AOJu0YwJ+d6dBp/m/u64PTHpQFcV2TAba9AxWlGvF4GhXfHQNSOTEQwP DOIDukuZNmlzx24XqUmbRDXuMlMl1qVGdDp5Jz+Whr77TrIAkQ9rtfrQ/Z+yid9qH5GVRNtQEwP GX7EyRiNVAtrq6o6dN0lHRmkBUitkcd0uUj0FnBGrbYVd28VWfLV1KQg= X-Received: by 2002:ac8:5e08:0:b0:437:b596:340c with SMTP id h8-20020ac85e08000000b00437b596340cmr4770491qtx.66.1714005828125; Wed, 24 Apr 2024 17:43:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWb6IaW3QPVqqyROW7kA4JhJron4tUVdn8T9fCr6VxEWusbTvZwvHFC5RtMSc1siQFhU6oDA== X-Received: by 2002:ac8:5e08:0:b0:437:b596:340c with SMTP id h8-20020ac85e08000000b00437b596340cmr4770480qtx.66.1714005827863; Wed, 24 Apr 2024 17:43:47 -0700 (PDT) Received: from [192.168.1.130] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id b26-20020ac844da000000b00436434cc3e4sm6522407qto.89.2024.04.24.17.43.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Apr 2024 17:43:47 -0700 (PDT) Message-ID: <5f6569bc-8d94-434c-b66d-137c8e7f5e64@redhat.com> Date: Wed, 24 Apr 2024 20:43:46 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] c++, v3: Retry the aliasing of base/complete cdtor optimization at import_export_decl time [PR113208] To: Jakub Jelinek Cc: Jonathan Wakely , Jan Hubicka , gcc-patches@gcc.gnu.org, Richard Biener , Patrick Palka References: <5fe9db40-4bff-4be4-a434-6509133f26e3@redhat.com> From: Jason Merrill In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.6 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 4/24/24 15:47, Jakub Jelinek wrote: > 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)? Yes, I think reorganize to ((DECL_INTERFACE_KNOWN (fn) && !DECL_WEAK (fn) && !DECL_ONE_ONLY (fn)) || (HAVE_COMDAT_GROUP && DECL_ONE_ONLY (fn)) Jason