From patchwork Mon Feb 19 13:51:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 203096 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1295117dyc; Mon, 19 Feb 2024 05:54:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX07CTspwOIFbftjNdBsQgRWVlTK6DGUbJKcJm1sxfirzSSEG+VziyvExtiSDFmdG5qZQqxQDGG2xV8T5nim3eROimxaw== X-Google-Smtp-Source: AGHT+IFVXFXL9+lI/2867g0y2qLHu4jwbfpTz7wOk0gKs7SJSsIx27T4OnSCu7ZrdHMDR3Uvx8TN X-Received: by 2002:a0c:e086:0:b0:68f:5d8f:7c14 with SMTP id l6-20020a0ce086000000b0068f5d8f7c14mr4948480qvk.19.1708350868634; Mon, 19 Feb 2024 05:54:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708350868; cv=pass; d=google.com; s=arc-20160816; b=X3qkDpQpK+ACeToaZPQ3ALXqrORuzVlPzaUqDFRt+CovDVgU1gU7dxy1vcVRFlkTKG +RwhZQx4vVBQEjvhKI5MkFC2rwaq7XflmjA8s1L3bnH8pBl63y2eKhAoF5Va2+1XTD2u vLJnbvNLDp8Dl1Rxf6kvWz0MoZc6km6YU28690YEtdtwN4nDi1dxtGJfFa5DpYV9chXo mfantP/s3owA7bRxMgAiHzWoZz8tNYuRbGfjqljApaiW6o0sy3SXR9rJ5Z1cuP5Vc9Ae /XvpXIyM6oGiaJw9OUjk075OEqnKgeLwJmFsyB/FVdgN3P2kxsIGKLLi85DH9k5QaVmN id8w== 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=JiZ9B0x6FgiG6MO3MczLWGvheK5B+fEhrXMz7V6EBsA=; fh=kSSy/oyUXqQD15FLeKdymIgDBFPFITPA1Gj52CNOxRQ=; b=Sm/4JWo83jWDA8Q1Hlo1+mVDiJWVJurXCl9JP2yzBfsZAJgg/WyGI7jODrq3q/wtRY NxMv1hqkbWV7bUGIGfusJptf3thVVjpypf4dec7jzspF/Utl9QIZ12Oo/AapGHj0GvfE OvPJbmtEvDO1SNiHzU8aBES/FhGWlOMGyGiTZ7Sx6l0uNi6D/L/KmiN7gAWUoatVhDHu Pu4UL/9qZHYdEk1nCW1IU0byLu/8o7W9N0IgR2r86I8iBGgQDdmIWuS4qL8KD1ye6xPV wlvtroJwZmcXRa0hj2G7UsgPNs8XrESF0XMyNSG6QhGpWAhRGy1Yjr97pjsLfDvAG2Do aPZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WhYU1ALW; 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 gu13-20020a056214260d00b0068d14789a92si1214486qvb.378.2024.02.19.05.54.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 05:54:28 -0800 (PST) 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=WhYU1ALW; 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 32569386486B for ; Mon, 19 Feb 2024 13:54:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32569386486B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708350868; bh=JiZ9B0x6FgiG6MO3MczLWGvheK5B+fEhrXMz7V6EBsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WhYU1ALWAIst9kW59VKhN9dRfKN+MZLS9ONNVhxCfOJZ77T3Omx6KXDKaMkKLC55U YeMLb4F4mWV623GbFMEY26dwwMkQ7IgVGZdVFvOakGi0YnHSo4hH36a7wI/cC5UCtY jxgyCTRu4XzVFR0J8ig6nZMSp/2LUXcgSFmB1NBk= 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 866CA384DEF8; Mon, 19 Feb 2024 13:51:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 866CA384DEF8 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 866CA384DEF8 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=1708350701; cv=none; b=KcVKGJUHQbED+0WzicgsEY1Q2MrI5D7F9gTemia1VEl+VeAGR7UrCidO8EgaWKPVhYVxsumNRNntkMQhv3UYsaZ/JpXycBja/mNY7KllQUKxkGQPZ98vdv345amFQSgSWaD9aQa7rc9HBsEsBQXRy4uaPFCQ2CyLddbi6AxPC6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708350701; c=relaxed/simple; bh=VYv1wMdTWXNgPdFXhF4pd+kvnGn1Jz7jNHVAYkCHFiE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=kZ5HcrZLrQpFrUmMA+vQcnQDnN/KFXKkSb7uDMAxjro054XVGlg4KwRYxmTvNoqzE6GyuBKdJ10/rpcg2j7NMLcDcpdK/IHbse6+0UPXUCfHYF2TXIKKvxkWM1H962wBfMyD4QmA00S/mAfxfV9cP6V3UeMeMRUeyTUIhs6emjM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0247474.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41JDpPRY031470; Mon, 19 Feb 2024 13:51:38 GMT Received: from mxout24.cac.washington.edu (mxout24.cac.washington.edu [140.142.234.158]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3wb6qmewyk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Feb 2024 13:51:38 +0000 Received: from smtp.washington.edu (smtp.washington.edu [140.142.234.157]) by mxout24.cac.washington.edu (8.14.4+UW20.07/8.14.4+UW24.02) with ESMTP id 41JDpaRK001137 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Feb 2024 05:51:36 -0800 X-Auth-Received: from kmatsui-ThinkPad-X1-Carbon-Gen-9.dhcp4.washington.edu ([10.154.74.143]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW24.02) with ESMTPSA id 41JDpZRS001026 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Feb 2024 05:51:36 -0800 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 v7 10/22] libstdc++: Optimize std::add_pointer compilation performance Date: Mon, 19 Feb 2024 05:51:17 -0800 Message-ID: <20240219135129.3635809-10-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240219135129.3635809-1-kmatsui@gcc.gnu.org> References: <20240106050754.3054782-1-kmatsui@gcc.gnu.org> <20240219135129.3635809-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-GUID: MoHAxwHx_fIrGCqUe4_fuP7QpBONhVRR X-Proofpoint-ORIG-GUID: MoHAxwHx_fIrGCqUe4_fuP7QpBONhVRR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-19_09,2024-02-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 spamscore=0 priorityscore=1501 bulkscore=0 phishscore=0 impostorscore=0 mlxscore=0 adultscore=0 clxscore=1034 mlxlogscore=521 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402190103 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, TXREP, T_SCC_BODY_TEXT_LINE 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: 1791335720463356899 X-GMAIL-MSGID: 1791335720463356899 This patch optimizes the compilation performance of std::add_pointer by dispatching to the new __add_pointer built-in trait. libstdc++-v3/ChangeLog: * include/std/type_traits (add_pointer): Use __add_pointer built-in trait. Signed-off-by: Ken Matsui --- libstdc++-v3/include/std/type_traits | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index c4585a23df9..6346d1daee2 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -2149,6 +2149,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; #endif + /// add_pointer +#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_pointer) + template + struct add_pointer + { using type = __add_pointer(_Tp); }; +#else template struct __add_pointer_helper { using type = _Tp; }; @@ -2157,7 +2163,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __add_pointer_helper<_Tp, __void_t<_Tp*>> { using type = _Tp*; }; - /// add_pointer template struct add_pointer : public __add_pointer_helper<_Tp> @@ -2170,6 +2175,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct add_pointer<_Tp&&> { using type = _Tp*; }; +#endif #if __cplusplus > 201103L /// Alias template for remove_pointer