From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by sourceware.org (Postfix) with ESMTPS id 1C1E9385DC0F for ; Fri, 8 Mar 2024 17:36:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1C1E9385DC0F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.washington.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.washington.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1C1E9385DC0F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::931 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709919399; cv=none; b=gti2wtzQ8EOniJEDSRPIrYqoWhOGs+MyjhFbEdNVa8oFeNWRcz4Pilwp71sp92xvDArr4Mg0q0n5brJkydZ1t0zw6vWh697szly3pgff5IiuLCq8bI1L+m6BluubnM9hqoIIbH+SBK5F69/JnIwXQYJOURA9kbOiWv/rxHJVg+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709919399; c=relaxed/simple; bh=6ZBAh9WF5wEafWKdh8uIl8BsXfri8V1q45LlQa6t9Hg=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=iQ1vqbU+50Ry+NARAAMl92qBUeSljEDO36+s9sPc6CJ5CoKOmOtwQniTCida4Q0eDvPtzu9WdbOFYl6C9jwOAtDfijF/RvaZhErDXgYasBBuEN0juGRPB/60ulfDfvjR14dEnAcu1o5QgOfanKiNamDIBp3rjg7g6aEqpsemqSo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ua1-x931.google.com with SMTP id a1e0cc1a2514c-7d5c40f874aso632040241.1 for ; Fri, 08 Mar 2024 09:36:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1709919395; x=1710524195; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QhRIqGiZMyBmikuelS9E8LZQFL/tAW0WnUudmUD1sLA=; b=G0P96vDKOGQOxlcxZ/BrMRsTu+vrySTGm5LHZ5vyrENwKqk/8fsvrEmUGRJxCXR6ox iU9q72lWiQJv0g4ORL53Ft78RPojNzxi3JoBOOj2n22zzhkF4kdBmw6EIj0GTk1hCcrK JtvhQkJUBI+l2nsxZV0s3ioKTBaJiFw+6G10M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709919395; x=1710524195; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QhRIqGiZMyBmikuelS9E8LZQFL/tAW0WnUudmUD1sLA=; b=FwPU0vcmJ34CEVmul7Y10tAhscyog1DnWdgIoCo4V8DBbVDdfAFCISK+DlyAlHms+4 4e1U+X6jxOHnG7qRqm7BofEen2QUeQi6vyrVcAOefflwySBVaNbWWnynMBBjZJ9Xhh7M nvGHYih0A2wNlQfM2wqQ4YJ843E9aPqxUjkl00mYmdNaR+rdjrUP4mXJxrQosh6VcgUx nvhS1m4hNOdQfUHBMmw6daqNtiw0E8L4+2Gk1LhZYMvP+GxQvQlvKEfyvthmRydDR5HM QQCqK0PjSrg9zRteHum79vfzNZHM8xxqIdrSDH4dhySudg/YheAKjaTCoL2SGPSautFL UtDw== X-Forwarded-Encrypted: i=1; AJvYcCW1h7qkrRiR2AsUJKWoKtJ8hxsEmGif8APs320PZE1WeRyClj0TFn6ttcPPmobRcJpuc9WGU5Xfp2zTh5L1gssDTiuEBr8= X-Gm-Message-State: AOJu0YxT9unUR4acP/ZBfeDSgiC7KEQrSlx0mxgIWPmM//GIkU3XIvaa DKJGQ2kTWFaT+aMISIjNNmyeASSBz1p4iVd+kj3H1Tv3e3o4FYfZFcSvYKSdo8Ff3B/UJ3ut9xp mYpeCB/aEgi3mutMai6xGigHuDZ8rC2/J5tuz X-Google-Smtp-Source: AGHT+IGFqXG7+8CF+XigiHkeYlGY+efO+eYDqlmagxWpP1y45pNNoCUafSRuOSXYxwDvj3a+QFTvg0hdorp2OlOH2v4= X-Received: by 2002:a05:6122:1d94:b0:4d3:37d1:5a70 with SMTP id gg20-20020a0561221d9400b004d337d15a70mr13850149vkb.7.1709919395364; Fri, 08 Mar 2024 09:36:35 -0800 (PST) MIME-Version: 1.0 References: <20240221093616.4001742-1-kmatsui@gcc.gnu.org> <20240228192843.188979-1-kmatsui@gcc.gnu.org> <20240228192843.188979-27-kmatsui@gcc.gnu.org> <03046523-864b-cf5d-1446-e4a88498b535@idea> In-Reply-To: <03046523-864b-cf5d-1446-e4a88498b535@idea> From: Ken Matsui Date: Fri, 8 Mar 2024 09:35:59 -0800 Message-ID: Subject: Re: [PATCH v14 26/26] libstdc++: Optimize std::is_nothrow_invocable compilation performance To: Patrick Palka Cc: Ken Matsui , gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,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 List-Id: On Fri, Mar 8, 2024 at 9:22=E2=80=AFAM Patrick Palka wr= ote: > > On Wed, 28 Feb 2024, Ken Matsui wrote: > > > This patch optimizes the compilation performance of > > std::is_nothrow_invocable by dispatching to the new > > __is_nothrow_invocable built-in trait. > > > > libstdc++-v3/ChangeLog: > > > > * include/std/type_traits (is_nothrow_invocable): Use > > __is_nothrow_invocable built-in trait. > > * testsuite/20_util/is_nothrow_invocable/incomplete_args_neg.cc: > > Handle the new error from __is_nothrow_invocable. > > * testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc: > > Likewise. > > > > Signed-off-by: Ken Matsui > > --- > > libstdc++-v3/include/std/type_traits | 4 ++++ > > .../20_util/is_nothrow_invocable/incomplete_args_neg.cc | 1 + > > .../testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc | 1 + > > 3 files changed, 6 insertions(+) > > > > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/includ= e/std/type_traits > > index 9af233bcc75..093d85a51a8 100644 > > --- a/libstdc++-v3/include/std/type_traits > > +++ b/libstdc++-v3/include/std/type_traits > > @@ -3265,8 +3265,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > /// std::is_nothrow_invocable > > template > > struct is_nothrow_invocable > > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable) > > + : public __bool_constant<__is_nothrow_invocable(_Fn, _ArgTypes...)= > > > +#else > > : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, v= oid>, > > __call_is_nothrow_<_Fn, _ArgTypes...>>::type > > +#endif > > { > > static_assert(std::__is_complete_or_unbounded(__type_identity<_F= n>{}), > > "_Fn must be a complete class or an unbounded array"); > > diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomp= lete_args_neg.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/inco= mplete_args_neg.cc > > index 3c225883eaf..3f8542dd366 100644 > > --- a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_ar= gs_neg.cc > > +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_ar= gs_neg.cc > > @@ -18,6 +18,7 @@ > > // . > > > > // { dg-error "must be a complete class" "" { target *-*-* } 0 } > > +// { dg-prune-output "invalid use of incomplete type" } > > Is the error coming somewhere from the new build_invoke function? That'd > be surprising since we pass tf_none to it, which should suppress such > errors. (You can probably break on cxx_incomplete_type_diagnostic to > find out where it's coming from.) Hi Patrick, Thank you for your review! This error comes from cxx_incomplete_type_diagnostic in check_trait_type, i.e., before the new build_invoke function. As we discussed previously, it would be better if we could produce diagnostics that are in harmony with libstdc++. > > > > > #include > > > > diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomp= lete_neg.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplet= e_neg.cc > > index 5a728bfa03b..d3bdf08448b 100644 > > --- a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_ne= g.cc > > +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_ne= g.cc > > @@ -18,6 +18,7 @@ > > // . > > > > // { dg-error "must be a complete class" "" { target *-*-* } 0 } > > +// { dg-prune-output "invalid use of incomplete type" } > > > > #include > > > > -- > > 2.44.0 > > > > >