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 AD8D43858D37 for ; Mon, 23 Oct 2023 17:05:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD8D43858D37 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 AD8D43858D37 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=1698080706; cv=none; b=Trj8l3S6VKhG84g+DgGwJPp6WqOr8Z+GwfkkqhZF6MzabcnUqyS3QHfb1IrklidNvcQP+B22CkYl0g6e8T3JJrBdDMxTqCc4OfgLZ4jYhbH1+fESZVYsw+EFFnixbB3obLPSHAu/NXW/IYPpvRxnnf6Gdm1mQOAQlGMqEgPGlYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698080706; c=relaxed/simple; bh=bbhBf9GzkPWlOrpubo6RYmeaP+xyu0kQ0nNZGX16WzM=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=TdLMu/Hu3DtR57rWVzqU6288hCmDsXCsSyyr+R4tJv6NfyTH5jjxQT1oCqDXhXsd510756JKjCuSHjTzBfSG/c9xEZTyuNbQRucmqIxl8GwPqg7ngEY01tA8DdxGIO2tudpgXdA3aNzr7Abb2+Nve8XvSqKXhZaVSpmbDRgKiWg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698080704; 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=k2xQI6jp2PC0ZCcwkUCrS+Et5tb+PAF6bo629POp1lA=; b=cPSpF0QykLmFHfxLyCWAIbJcOHu26oigvLEHstPM6OQ6Zzl+SjhUo5+9K7EDdVY7zRiVp7 f+ESglynvb3bssyyCB8uAJD8UkmXepGU3YRYtP2xwzyll9XJcyWPwdrcMN0M8QbzpAoapg XVU4rsJGDduVkhTILnctu4/IYUzOUfE= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-574-ogm10KcMNdWdFBiJGIE29g-1; Mon, 23 Oct 2023 13:05:03 -0400 X-MC-Unique: ogm10KcMNdWdFBiJGIE29g-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-507ceeff451so3686841e87.0 for ; Mon, 23 Oct 2023 10:05:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698080701; x=1698685501; 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=k2xQI6jp2PC0ZCcwkUCrS+Et5tb+PAF6bo629POp1lA=; b=pENAAmBc7b8/5mqPhCpoifzpRH6vj9eF2w3oFk6SwKLDw3baB7YJNjhKD+o/hdbwpI mqQ1ZoJhdySW9q8rbbwxrCafcVsde5SmYvJ9zhCt0y59inWs1e3Li9P37X7KfrS0+XNI vKoxw1lZNIX3rPQj5O0fwtGyLBEhEBE8c1L+WrTMl+EIozuRX4MS3uNSkF2w86IXEham KGt6p6vt8SSL94jMlr2CkWMA2hSTxTrtWP6yG25vNVJQW+e5cC30+B9dBoLsDy6k5N0u OLBnS1/y1T3klJIfMlp+v976gVbVN+u4tBOahWs7dWkFGDHH31e5hFu25yI8Jzcqy33G Jrug== X-Gm-Message-State: AOJu0Yw3zjybv0IDTKb3OFVYRsY7GkfHHLBaaeEYFzFtVlCqQmeIItR9 b4SXTaz4Rh/sZ3YxarUrmlWhwnuvUMzBWgLSI1tw5hg2hQ7YvLN4ctx8/VkaJKbhCpZ7vMYwWP3 frYSGz3KZrbBeBR/QJ2ZLUYFw/Me0BRU= X-Received: by 2002:a19:6745:0:b0:507:9fc1:ca7e with SMTP id e5-20020a196745000000b005079fc1ca7emr6248296lfj.51.1698080701497; Mon, 23 Oct 2023 10:05:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsDBMAPMl3LDkqQ1GIoUDLuGP0y8DGnmL7ZigJqDp29h9wQM0pCotCH/RVsDZJibDHQ7ac0/oj/1CaeZ3ZWgs= X-Received: by 2002:a19:6745:0:b0:507:9fc1:ca7e with SMTP id e5-20020a196745000000b005079fc1ca7emr6248280lfj.51.1698080701091; Mon, 23 Oct 2023 10:05:01 -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: <20231020162115.2307797-34-kmatsui@gcc.gnu.org> From: Patrick Palka Date: Mon, 23 Oct 2023 13:04:50 -0400 Message-ID: Subject: Re: [PATCH v24 33/33] libstdc++: Optimize std::is_invocable compilation performance To: Ken Matsui Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,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 Fri, Oct 20, 2023 at 12:22=E2=80=AFPM Ken Matsui w= rote: > > 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. > * 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...>::typ= e; > > /// 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>::typ= e > +#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.c= c 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 >