From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe31.google.com (mail-vs1-xe31.google.com [IPv6:2607:f8b0:4864:20::e31]) by sourceware.org (Postfix) with ESMTPS id BBA763858281 for ; Mon, 23 Oct 2023 17:14:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BBA763858281 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 BBA763858281 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::e31 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698081275; cv=none; b=W4EwpT6h/gGD2gHKnt832e85+nVV0XZgTbRIp1/mFgv46jI24tNsXggKaPSEUCltSBRr+cKqClI3t3NqIeeOuhfb//FFydxBe93nmUzj8eJlzHAtXOJ/aOG2tlw75QMVfVB9Pt4zZWeurUGE7zex/XxnKi8XDZ21YF5/3DKlsNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698081275; c=relaxed/simple; bh=/sE4b/wW4IVcYGcwpUeLmNp2OJfIIkhYkJBfVAh89fk=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=oBpUEWtDh9RGrDhPNBuy9UHfz5Xe/5hpXqCBWD0vVym/ale5C89PxIl+BU2B9/qBZ5/Ys+GNFmPdcTdDubfykeHdET57DhsOVsB4ZL7XnTuQQxS/ZD/yQncDdCFG1lqxzlDxTH7fuxRjmYSIqDAPZbOydKTnAHGIDZVOz+OcRpI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-vs1-xe31.google.com with SMTP id ada2fe7eead31-457e9088d7aso1217741137.1 for ; Mon, 23 Oct 2023 10:14:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1698081273; x=1698686073; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=km/RXrhcwiTS+WyKz6qpezXn66DNG5AoJEpCazXqHOY=; b=Yu2LyVgzWu9cwgmIvWXYn4JvCXmj2VqCxaAoQwMHikOssI9X2hzP92J5xsdZUfCZO/ 3oY640Y7gMOS8XhUVof5WvACzVc7XBMGDSEwF6t5qcWpSEzjtQfBrpaozp2qxifAk/7B RcPYjhNZHRJufaJaDZWrZt83P0Vy4rBlHoF0w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698081273; x=1698686073; h=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=km/RXrhcwiTS+WyKz6qpezXn66DNG5AoJEpCazXqHOY=; b=kTK2v4TfUK19ijuz8BYiEKgwH5lkJsb7hc4ttxpRWXrnFqFWxwAkn4VqA4RDlTQPBo 6c7FVWaptzgIOTwPvpJujNsfh3E+NDCFgUxNphHHSBafxwyiKYifch7nYCSxuvpEE87/ Ne0UK/+FuCqwbEVojjPIxn0fDTiYo32wJwEk0ql3J/3FoRA/3iaQXOA9Evsdqr4XkJ20 DRP+lIkHItpp1x1C/xvFn8S8YBTpgbVuxWOEF2ioINiIU1WkJmDBmkfrnYXBDlmeodsU FuLsqzReJCxTWcfn7TsEjuY8Wry7CV3Va5NxJ+tD9vtKQTXZvQbZud5vnRucxOxkYOwh 8T5w== X-Gm-Message-State: AOJu0YyewAqn0Jy52nsYy2XVSOxz3giTphrNc/+jH2dTsI2J2Jl0Stx5 fu0o9pHj5zfO6XA9wuL76Y83x0GYwFjFqdinW1vaDQ== X-Google-Smtp-Source: AGHT+IHxCMvDSmyOcO6acpRlsn0nUQXB/S+1Yvzc46Ozjp+U+U3C3mdTjum1E/fVM1dc85Ow2eBlz+mptGpK6klgX3c= X-Received: by 2002:a67:c10a:0:b0:452:dae8:df05 with SMTP id d10-20020a67c10a000000b00452dae8df05mr9651169vsj.9.1698081272827; Mon, 23 Oct 2023 10:14:32 -0700 (PDT) MIME-Version: 1.0 References: <20231020135748.1846670-1-kmatsui@gcc.gnu.org> <20231020162115.2307797-1-kmatsui@gcc.gnu.org> <20231020162115.2307797-34-kmatsui@gcc.gnu.org> In-Reply-To: From: Ken Matsui Date: Mon, 23 Oct 2023 10:14:22 -0700 Message-ID: Subject: Re: [PATCH v24 33/33] libstdc++: Optimize std::is_invocable compilation performance To: Patrick Palka Cc: Ken Matsui , gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Content-Type: multipart/alternative; boundary="00000000000011266e0608655bb3" X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,HTML_MESSAGE,KAM_SHORT,RCVD_IN_DNSWL_NONE,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: --00000000000011266e0608655bb3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Oct 23, 2023 at 10:05=E2=80=AFAM Patrick Palka = wrote: > On Fri, Oct 20, 2023 at 12:22=E2=80=AFPM Ken Matsui = wrote: > > > > This patch optimizes the compilation performance of std::is_invocable > > by dispatching to the new __is_invocable built-in trait. > > > > libstdc++-v3/ChangeLog: > > > > * include/std/type_traits (is_invocable): Use __is_invocable > > built-in trait. > > Nice! We should use the trait directly in is_invocable_v too. > Thank you! But we want to take account of static_assert=E2=80=99s in is_inv= ocable, so I think we cannot use the built-in directly? > > * testsuite/20_util/is_invocable/incomplete_args_neg.cc: Handle > > the new error from __is_invocable. > > * testsuite/20_util/is_invocable/incomplete_neg.cc: Likewise. > > > > Signed-off-by: Ken Matsui > > --- > > libstdc++-v3/include/std/type_traits | 6 ++++++ > > .../testsuite/20_util/is_invocable/incomplete_args_neg.cc | 1 + > > .../testsuite/20_util/is_invocable/incomplete_neg.cc | 1 + > > 3 files changed, 8 insertions(+) > > > > diff --git a/libstdc++-v3/include/std/type_traits > b/libstdc++-v3/include/std/type_traits > > index 75a94cb8d7e..91851b78c7e 100644 > > --- a/libstdc++-v3/include/std/type_traits > > +++ b/libstdc++-v3/include/std/type_traits > > @@ -3167,9 +3167,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > using invoke_result_t =3D typename invoke_result<_Fn, _Args...>::t= ype; > > > > /// std::is_invocable > > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable) > > + template > > + struct is_invocable > > + : public __bool_constant<__is_invocable(_Fn, _ArgTypes...)> > > +#else > > template > > struct is_invocable > > : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, > void>::type > > +#endif > > { > > > static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}), > > "_Fn must be a complete class or an unbounded array"); > > diff --git > a/libstdc++-v3/testsuite/20_util/is_invocable/incomplete_args_neg.cc > b/libstdc++-v3/testsuite/20_util/is_invocable/incomplete_args_neg.cc > > index 34d1d9431d1..3f9e5274f3c 100644 > > --- a/libstdc++-v3/testsuite/20_util/is_invocable/incomplete_args_neg.cc > > +++ b/libstdc++-v3/testsuite/20_util/is_invocable/incomplete_args_neg.cc > > @@ -18,6 +18,7 @@ > > // . > > > > // { dg-error "must be a complete class" "" { target *-*-* } 0 } > > +// { dg-prune-output "invalid use of incomplete type" } > > > > #include > > > > diff --git > a/libstdc++-v3/testsuite/20_util/is_invocable/incomplete_neg.cc > b/libstdc++-v3/testsuite/20_util/is_invocable/incomplete_neg.cc > > index e1e54d25ee5..92af48c48b6 100644 > > --- a/libstdc++-v3/testsuite/20_util/is_invocable/incomplete_neg.cc > > +++ b/libstdc++-v3/testsuite/20_util/is_invocable/incomplete_neg.cc > > @@ -18,6 +18,7 @@ > > // . > > > > // { dg-error "must be a complete class" "" { target *-*-* } 0 } > > +// { dg-prune-output "invalid use of incomplete type" } > > > > #include > > > > -- > > 2.42.0 > > > > --00000000000011266e0608655bb3--