From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7934) id 9D10D3870883; Sat, 16 Dec 2023 17:00:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D10D3870883 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702746024; bh=zfrLQ2yRwhaw5oq2PPACMO9NiRFT1/BhwQto4cVxfKg=; h=From:To:Subject:Date:From; b=O4KsFOX/gE+PLzcvTt/txS9RKZliTXB6K8QQ8p13zJZM/BUQC4FHb27IBSvnGy6K8 Yd2azzIaVMZHTVxAstaeyxtD980gLDO+dmoGZIi8Kz0O5miNvt7dqgQamP1xr/1lI3 kt8rC1vCvc7mZMdUhfF/knqE3FitrnShGbd9x93c= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Ken Matsui To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-6626] libstdc++: Optimize std::is_member_pointer compilation performance X-Act-Checkin: gcc X-Git-Author: Ken Matsui X-Git-Refname: refs/heads/master X-Git-Oldrev: 4a235f8eb0f19292c007c4374d6b48ab01667a3b X-Git-Newrev: d95e54347f84e16d09f89547f836d2a05c667c57 Message-Id: <20231216170024.9D10D3870883@sourceware.org> Date: Sat, 16 Dec 2023 17:00:24 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d95e54347f84e16d09f89547f836d2a05c667c57 commit r14-6626-gd95e54347f84e16d09f89547f836d2a05c667c57 Author: Ken Matsui Date: Mon Sep 11 20:35:53 2023 -0700 libstdc++: Optimize std::is_member_pointer compilation performance This patch optimizes the compilation performance of std::is_member_pointer by dispatching to the new __is_member_pointer built-in trait. libstdc++-v3/ChangeLog: * include/std/type_traits (is_member_pointer): Use __is_member_pointer built-in trait. (is_member_pointer_v): Likewise. Signed-off-by: Ken Matsui Reviewed-by: Jonathan Wakely Diff: --- libstdc++-v3/include/std/type_traits | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 4a5068791af..4ab1d29ff51 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -716,6 +716,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct is_compound : public __not_>::type { }; + /// is_member_pointer +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer) + template + struct is_member_pointer + : public __bool_constant<__is_member_pointer(_Tp)> + { }; +#else /// @cond undocumented template struct __is_member_pointer_helper @@ -726,11 +733,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public true_type { }; /// @endcond - /// is_member_pointer template struct is_member_pointer : public __is_member_pointer_helper<__remove_cv_t<_Tp>>::type { }; +#endif template struct is_same; @@ -3228,8 +3235,15 @@ template inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; template inline constexpr bool is_compound_v = is_compound<_Tp>::value; + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer) +template + inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); +#else template inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; +#endif + template inline constexpr bool is_const_v = false; template