From patchwork Tue Oct 24 02:01:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 157210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1669886vqx; Mon, 23 Oct 2023 19:12:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGijF1qqKx9OUH8xbHOQF6AVvLdj3giiXGvT2p7lF5NClXtabnYusddmhn5YG69SA4lD0/K X-Received: by 2002:a05:6214:2465:b0:66d:5ee5:815b with SMTP id im5-20020a056214246500b0066d5ee5815bmr10056495qvb.64.1698113540500; Mon, 23 Oct 2023 19:12:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698113540; cv=pass; d=google.com; s=arc-20160816; b=X1mkwWNXGfja8jFlZF5SraUpgzcsGMSlgiPZl+MHCpS5++wFAtaxHpBNj4e6btwOU5 OJBV3XSGvKeNRaL+XF5wo/HEj9VVPjOYOUCW+piAAoCNGIzCoEaQCtuB3549HBKdFkLh 5BdWqb0GebsTzt94BX+ePxzKE5mHlz2Il3Gq7AG+slFKskyzdCQLJs0rwnxbn80Pm+Ws a28juIk8+Rvc3ioFecVNJ1J8jhcEglrIC6hndduPSxjroFlgNtxEWwoUDYlBXF1/U8jz MIiVOBKp2/dlE69TvR1zjZD8RUsjZxwAhW4VZYgQwhsVuyvwv4ZYfn1rVfVqVIyHDiVb CzRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:arc-filter:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=7rQNM7Itqay5ML8ILfjQvzDy+0HBUHMW8aJ5mHVBK6Q=; fh=kSSy/oyUXqQD15FLeKdymIgDBFPFITPA1Gj52CNOxRQ=; b=nMt94TVDoPDKVL3ezHSaWV2MAi2/nAchHrLJ4EwhM0oB7haIl0ROY6VtXQRFc7R/B0 Zg3ia/xTh3Bhsw7WC4Z8/2VpjaE/c+7rymdz+m0Udf8j0j8+FmG10QbAwt19i6NjVJz6 ynLcmc1VHnCYFzRFJozAYDrTRG0h3sKx9uWDfn3W8EVHv212zcpc0ef6kP16u0LcKKMd 6NdtD4OgHoGTTPHCWf06ASXJjteqBsaGJCqS4su2gJ5QFA6mBasxwaSY788V8y54EpLb nKAasF3UMOyo3wTrrBas7tmDkzqoQ8HGmZyBLf7pihA5CbX4J8A9dI3dOWU7UUGfYtzc gwyw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=LDnxjhtG; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d13-20020a05621416cd00b0066d045558e3si6433574qvz.307.2023.10.23.19.12.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 19:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=LDnxjhtG; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BB4EC385276F for ; Tue, 24 Oct 2023 02:12:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB4EC385276F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698113524; bh=7rQNM7Itqay5ML8ILfjQvzDy+0HBUHMW8aJ5mHVBK6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LDnxjhtG4Tzaxn5AeJzkVdxXXx3sROh5y4QNBgetHnVV3y4i997tyAwsLVfGue/Tw OaC4CsGfx8AtlLlKzNDWcwjuFes5wd8j9n5sn8jDolTdAfCz1gMCf/LnIMSanVz5vv b1v/aZNrAEQFWMLjFqqbgpEZfKvh6ymx+A0isL+0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id ACBF03856DC2; Tue, 24 Oct 2023 02:05:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ACBF03856DC2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=gcc.gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ACBF03856DC2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.165.146 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698113113; cv=none; b=mJc1WxcTmVEWWi993EVCy+SAUL3pVo7iCdw70m16YR8XbHkwGEGQCv24KKeEozX2el9nbNj7ZziZpTu0qVpTdtWDLnNbfG/Z3WyjEL9jm3QKGY4C6kxIAbYz42fec65nwUtLfii3GSREtFALzMqhnpXxAdAYgEpzUs3UNlWb/3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698113113; c=relaxed/simple; bh=wI0kHfzeWzUuzKIGqkYmYNWpi+wV8yu1uL/mcysXSqY=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=CS299fRb0doy0S/ZZ/2XwiS1SaJJDVfrFaT0bFts86Z2WYGIRyNUMP0YPCMBqRo92wVIhx58zyeAvoAgcG8vvDxjih7X9J1Dv8qrU6WCQP1hNxQ3RytqmW840zj43UMB+MeWkZq5XvJzN01fghzpq7+jWF5DV+yq2TIHuJigB4s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0247470.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39O1wrtb023031; Tue, 24 Oct 2023 02:05:10 GMT Received: from mxout23.cac.washington.edu (mxout23.cac.washington.edu [140.142.32.140]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3twu6r64a8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Oct 2023 02:05:10 +0000 Received: from smtp.washington.edu (smtp.washington.edu [140.142.234.157]) by mxout23.cac.washington.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 39O24gFT025733 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Oct 2023 19:04:42 -0700 X-Auth-Received: from kmatsui-ThinkPad-X1-Carbon-Gen-9.dhcp4.washington.edu ([10.19.18.191]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 39O24TmF031305 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Oct 2023 19:04:41 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu From: Ken Matsui To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH v25 17/33] libstdc++: Optimize std::is_member_pointer compilation performance Date: Mon, 23 Oct 2023 19:01:00 -0700 Message-ID: <20231024020424.699427-18-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231024020424.699427-1-kmatsui@gcc.gnu.org> References: <20231020162115.2307797-1-kmatsui@gcc.gnu.org> <20231024020424.699427-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-GUID: rxKvQllOovaoo2iq97c66IJn8vdfDPz5 X-Proofpoint-ORIG-GUID: rxKvQllOovaoo2iq97c66IJn8vdfDPz5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-24_01,2023-10-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 phishscore=0 priorityscore=1501 mlxscore=0 spamscore=0 clxscore=1034 impostorscore=0 mlxlogscore=384 lowpriorityscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310240017 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NEUTRAL, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780601103665571273 X-GMAIL-MSGID: 1780601103665571273 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 --- libstdc++-v3/include/std/type_traits | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 7fd29d8d9f2..d7f89cf7c06 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; @@ -3242,8 +3249,14 @@ 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 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const) template