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 23A0F386F802 for ; Fri, 10 May 2024 19:59:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23A0F386F802 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 23A0F386F802 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=1715371171; cv=none; b=QPQFcp8wOpvwPhyYqzHNjQw2VZAGnT94kIzu1KpaKi9jslGIKqT3MP4G0/FYktswLl/tjjTPZPMt8x5o4slDMpk74ihOOij8gQWYRP1un+X3KRcYPbaja+F6CVkNltdsa7cuS4nzaGxZ1xLcMSnibia9O8amVkSvJVo5pWfTiZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715371171; c=relaxed/simple; bh=FlccK03+yvRpoiJj90ukgkDybJvnGucIiSaRu3nYM9M=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=xlhCXIu1gB6w7SCViUh4Q7JIEQVyJVyrEbu2HxH7yQyIS+ILLW0xEloy5zC00P/X1PkIXJIvsypWBcXNMlKfFm9iJXrrALw2rd0RvtomWicD2r8Tg/pUc8UHsuNy357KNWR00SNDV27zlxeKm874rNwK/8A1X8/NQdAL+zgMD2A= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715371169; 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=Tp22ZNnhYs+cukkQJRJw8LTNmJeJqA0W8xmoRizkS3E=; b=SgztFtsxvGf3QyI50lWNrLO3PG63jdB2zAgEVJyJiRnYX6US24KvQjnxFbuZPgxBzUOYPJ 1OdvGN3Dd8xYTq8/rIylpDwv6KmMaNWDT7tFh4dRYsn99yYoyJ6u2hPvpKmAlCcQyZIo2q yxYaTacQlKH69QZXrv3SlBS83ONvG2c= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-456-86iIbz5cMwiH6h6Rw0DyeA-1; Fri, 10 May 2024 15:59:28 -0400 X-MC-Unique: 86iIbz5cMwiH6h6Rw0DyeA-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6a0e10bddd6so26204176d6.3 for ; Fri, 10 May 2024 12:59:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715371168; x=1715975968; 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=Tp22ZNnhYs+cukkQJRJw8LTNmJeJqA0W8xmoRizkS3E=; b=nPPQdXvhWSBmcn+mL5INBSpqacBFjZP4WVTPmfKumSUVu3m6eoo2VDdrWMZRKmE+0M Bs/gAQjKGhbqw9F6sE53tFVjtbTRu6MB4qXOKGUgfDBW7GBdGjKWT7tIg9GBcDiYkAxS yxo6IquPhyJpUyKJEYlY07B+SuObqSXIIwld++vft05WR2PGCK2ahdEPzhHQyjtYNLkI cLtE0HxILv29MLhrCphl2fYbl7m9KhhZ0eloeuV5KnnjLcimlSMAROeMCkNJ+/LLa6/6 DnPqUSssufF1lzD2C4OeGR0+hJzWmkSCZvDctRxxm3FyhsePJfGUBwEyPLDVE2Da+YSh 5coA== X-Forwarded-Encrypted: i=1; AJvYcCUAmDtZt4jsJHPLax/swmdchspqpcifMZAvwM3VKjO7/SRGAKSZNnwDLI08cwrVDQgHzYxGzruXjEdroCurWUpFnxhM9UaBRw== X-Gm-Message-State: AOJu0YxSBA/iIOHD8ii4u1YdEcXsk1KEiTYmnv/vDT7w4WBZvYcwgAb3 Kana+QS/WIUFCFHMfFJTCW1+cirK5N90V3cI5hwRJ1h4MACk/4lW1gVURPenfGXAbUMHBerefwA S7OFYRzkbviHQ0ChYTfx8FKHjEfYbjK7+sE18ERr+AF8MikPzoDz1W4Q= X-Received: by 2002:a05:6214:2dc5:b0:6a0:b905:96ed with SMTP id 6a1803df08f44-6a168377306mr40214436d6.43.1715371167845; Fri, 10 May 2024 12:59:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdW73TPE0o6cRONgIkNL46FsmVVtsk3phlV7lHaNPpFFdzH6T2Lt1ETG4HSQmf/w35T9GQgA== X-Received: by 2002:a05:6214:2dc5:b0:6a0:b905:96ed with SMTP id 6a1803df08f44-6a168377306mr40214226d6.43.1715371167543; Fri, 10 May 2024 12:59:27 -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 6a1803df08f44-6a15f185358sm20098336d6.36.2024.05.10.12.59.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 May 2024 12:59:26 -0700 (PDT) Message-ID: Date: Fri, 10 May 2024 15:59:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] c++: Optimize in maybe_clone_body aliases even when not at_eof [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> <5f6569bc-8d94-434c-b66d-137c8e7f5e64@redhat.com> <32bfcf8c-1b45-444c-8729-e560952fe44b@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 5/9/24 14:20, Jakub Jelinek wrote: > On Thu, Apr 25, 2024 at 11:30:48AM -0400, Jason Merrill wrote: >> Hmm, maybe maybe_clone_body shouldn't clear DECL_SAVED_TREE for aliases, but >> rather set it to some stub like void_node? >> >> Though with all these changes, it's probably better to go with your first >> patch for GCC 14 and delay this approach to 15. Your v1 patch is OK for 14. > > Ok, here is an updated patch, which sets DECL_SAVED_TREE to void_node for > the aliases together with reversion of the earlier committed patch. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2024-05-09 Jakub Jelinek > Jason Merrill > > PR lto/113208 > * cp-tree.h (maybe_optimize_cdtor): Remove. > * decl2.cc (tentative_decl_linkage): Call maybe_make_one_only > for implicit instantiations of maybe in charge ctors/dtors > declared inline. > (import_export_decl): Don't call maybe_optimize_cdtor. > (c_parse_final_cleanups): Formatting fixes. > * optimize.cc (can_alias_cdtor): Adjust condition, for > HAVE_COMDAT_GROUP && DECL_ONE_ONLY && DECL_WEAK return true even > if not DECL_INTERFACE_KNOWN. > --- gcc/cp/optimize.cc.jj 2024-04-25 20:33:30.771858912 +0200 > +++ gcc/cp/optimize.cc 2024-05-09 17:10:23.920478922 +0200 > @@ -220,10 +220,8 @@ can_alias_cdtor (tree fn) > gcc_assert (DECL_MAYBE_IN_CHARGE_CDTOR_P (fn)); > /* 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)))); > + return (DECL_WEAK (fn) ? (HAVE_COMDAT_GROUP && DECL_ONE_ONLY (fn)) > + : (DECL_INTERFACE_KNOWN (fn) && !DECL_ONE_ONLY (fn))); Hmm, would (DECL_ONE_ONLY (fn) ? HAVE_COMDAT_GROUP : (DECL_INTERFACE_KNOWN (fn) && !DECL_WEAK (fn))) make sense instead? I don't think DECL_WEAK is necessary for COMDAT. Jason