Message ID | 20231024020424.699427-24-kmatsui@gcc.gnu.org |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1667862vqx; Mon, 23 Oct 2023 19:06:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFmSMM/cBLCLzVEE6L/ewnk9lEM57mNqG4CGTDLFRPyU7jWXaLInK6nRfQuLGrq2CbmQll X-Received: by 2002:ac8:5c47:0:b0:419:529e:dcfd with SMTP id j7-20020ac85c47000000b00419529edcfdmr11261332qtj.3.1698113203780; Mon, 23 Oct 2023 19:06:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698113203; cv=pass; d=google.com; s=arc-20160816; b=waA/OjPCgzXnGP3ThkRicGsyjLwOhZYhyMjsLMoGOv9JRVPo7/v2OnGjYT7XQPqCMa atdQXEP9lpomfyd0RIYnBY0Eq9oD+dZuK/qa42FFtBFtm9lDWI//ntQgc4NqSWCnYgiv UGACUXhNyZs+8u0winXasnAsyr6mLvh0gRZNndV2aDBjZAwI7j0XHBZCMlmZ5FGtLKYu 5h4ZdVU/0Jrq5vMIAul225dIXkrtBgt3iphNLFlQJM4is9PeFHVjP2YEDQFBmRfxLyC8 JiWA2TJw0letPDaaUYc2cqI6VIf262mluBs3LNiS/7Z+D7rkOYe7zBCXURB4hUJ0okSG +77g== 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=zYgCUva5YSX3VVbXE+VHouPptfMX0yoA72i0AoolsjA=; fh=kSSy/oyUXqQD15FLeKdymIgDBFPFITPA1Gj52CNOxRQ=; b=f3LKL5uGH43Q/5bQIuZUkhi8SkmAOiV54E14naU2g8wGitDcGY6E8mLaamBkUhoCCq H39B/V3+NaRz/2Jlx82q8LOjRQyY9zUMtYKygIN1h22tITvkELnqDc9UPlpDCjo+bneo wJjfDf2XyGsQdyXhFfHaMVGSDRK6CDlvawcsBtL6DuoSh/xgHxC6XR4YmFzuE/keDYbq kcoibvDgY3MZYXJdMRhu3Y/jVEK+ZW5ZsHye8j9MmXqLZ1/GOJpMW19PEFbYOGr0jxDa stsTgKco0H6Cs4rxPO1Wbz/8iLhpw4kA2IUyL5umpFob9lyAf/a+4+KEVAbZFFVdtdX6 0/Kg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=b8QDqcHo; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id t18-20020ac85892000000b0041cc795c5e3si6427587qta.759.2023.10.23.19.06.43 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 19:06:43 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=b8QDqcHo; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 CCEA53858C5E for <ouuuleilei@gmail.com>; Tue, 24 Oct 2023 02:06:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCEA53858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698113202; bh=zYgCUva5YSX3VVbXE+VHouPptfMX0yoA72i0AoolsjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=b8QDqcHoni/0Hv8MUUyO1TeSReho/ZNa0MJKz0nbCwN7X2gU6sIOrUQfq/xQyYKio /5ceq24jUquLFDds3QXKacpnw154B0VZIUj2GkcZEGt+gRvV84lAbb8na5HnWopOSQ 8R4/HtI4lfEdJMrZRoc8EBRNflRnrwE6viMaHGOg= 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 5E9DE385770D; Tue, 24 Oct 2023 02:05:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E9DE385770D 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 5E9DE385770D 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=1698113103; cv=none; b=ZJvdqEIgpNbP2IdspLhlWB4+5Spuu82cWhpLwkadG6viuBfDxaYwLnMFZDQ5WY6hrcVs1Bk+MjgzVauUilPriFximweAZpPfD+isenZz5Y6tiog6v4uL2yjyeAZbvQb8eMkOMByfRlGtU7MGkhTeN2LxLcCZYNCJvljBmE7ivek= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698113103; c=relaxed/simple; bh=0xIdNOWGmtTEfRO3CIEcLeGXhFHo56hqbxyj3AOi340=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=g0Ht/mEM5s+KcJEYkfvdDF0bEAnYI+1Xm7Ym4GKmJ6ajdtScNWk8Y1ECAhWAZrgqxVfQrqR6PEzicXOijFgQNUGcVmvg+MFpqhPlotg7I4/htZwCdoyZOlhg+fK928+xhxz9J5JnVyj+76Z2D+YqWqT3JPJxmyAggmwgZmg72GA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0247473.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39O1uYHT010704; Tue, 24 Oct 2023 02:05:01 GMT Received: from mxout22.s.uw.edu (mxout22.s.uw.edu [128.95.242.222]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3tx1eesc3m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Oct 2023 02:05:01 +0000 Received: from smtp.washington.edu (smtp.washington.edu [140.142.234.157]) by mxout22.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 39O24jx3025073 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Oct 2023 19:04:45 -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 39O24TmL031305 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Oct 2023 19:04:45 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu From: Ken Matsui <kmatsui@gcc.gnu.org> To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui <kmatsui@gcc.gnu.org> Subject: [PATCH v25 23/33] libstdc++: Optimize std::is_reference compilation performance Date: Mon, 23 Oct 2023 19:01:06 -0700 Message-ID: <20231024020424.699427-24-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 Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: GqKV4w5I5EY6c97KfBi5ZK3Cqcc0F29m X-Proofpoint-GUID: GqKV4w5I5EY6c97KfBi5ZK3Cqcc0F29m 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 mlxscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=711 clxscore=1034 spamscore=0 bulkscore=0 suspectscore=0 adultscore=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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780600750884623446 X-GMAIL-MSGID: 1780600750884623446 |
Series |
Optimize type traits compilation performance
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Ken Matsui
Oct. 24, 2023, 2:01 a.m. UTC
This patch optimizes the compilation performance of std::is_reference
by dispatching to the new __is_reference built-in trait.
libstdc++-v3/ChangeLog:
* include/std/type_traits (is_reference): Use __is_reference
built-in trait.
(is_reference_v): Likewise.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
libstdc++-v3/include/std/type_traits | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 792213ebfe8..36ad9814047 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -682,6 +682,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Composite type categories. /// is_reference +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference) + template<typename _Tp> + struct is_reference + : public __bool_constant<__is_reference(_Tp)> + { }; +#else template<typename _Tp> struct is_reference : public false_type @@ -696,6 +702,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct is_reference<_Tp&&> : public true_type { }; +#endif /// is_arithmetic template<typename _Tp> @@ -3264,12 +3271,19 @@ template <typename _Tp> inline constexpr bool is_class_v = __is_class(_Tp); template <typename _Tp> inline constexpr bool is_function_v = is_function<_Tp>::value; + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference) +template <typename _Tp> + inline constexpr bool is_reference_v = __is_reference(_Tp); +#else template <typename _Tp> inline constexpr bool is_reference_v = false; template <typename _Tp> inline constexpr bool is_reference_v<_Tp&> = true; template <typename _Tp> inline constexpr bool is_reference_v<_Tp&&> = true; +#endif + template <typename _Tp> inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; template <typename _Tp>