Message ID | 20240228192843.188979-17-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:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3568360dyb; Wed, 28 Feb 2024 11:38:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW7B2oyDDD73JwTxvsaSt79kIF5WgP8QWvr2Wgkx0W28y8+n8379oasc4i0jyW4A1No2ctr5el9oLUGjr5kMPJjyrqRBA== X-Google-Smtp-Source: AGHT+IG60Ka+stgJ1+JUYa1kORAAEeTHlgsuyJXoT5Q+jhEUc/IV7ueuusl1kelgJN9p+OX30180 X-Received: by 2002:a05:6808:21a6:b0:3c1:b3c8:fbf3 with SMTP id be38-20020a05680821a600b003c1b3c8fbf3mr5131914oib.3.1709149117970; Wed, 28 Feb 2024 11:38:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709149117; cv=pass; d=google.com; s=arc-20160816; b=PcRbXbHqqYTcX39fgHnqkMS5yvfvLBbboOF62X6qU0qSgZJIN6u57mnBSX5bHHFZtG f090RswAGd5VekXHhc/QNzAth/2lGz8/Xzdcu6lAUqeGjFzFDBdc2IP39m3d5GPpbOVB tCbP+D6fScFU51Uxav1DVic8KCYHanhslpmPPh+EJRF+YV1vfEc4OQ7VQevLkn3SjaNq yUORK9+4uetPN0X3HxZWAUE3UaiDo9y+roXNoNnwSKKxSCFVpXu3saYLN+8WBr7RAb3w 0HSjz1pdmfzxgoYJnwUHtvRoh4jVMoULl03XjO0jY4h07wuPSx+4I1P6forYn7PEL48F dYpg== 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=n5wLONU2u6JlIhFT8HIAB40eZiuJ42IeVNr0AnCccHY=; fh=kSSy/oyUXqQD15FLeKdymIgDBFPFITPA1Gj52CNOxRQ=; b=CQSp/UrWUX/MB8dyB0R38OCvoPL7CJDb0ytrgfrNH4mPkRNbmp0yOC23Bp1B2MCz1a 20oz9YSq6sSH+xJ+9vlDqpLG+gS9tv/+oPmPeL69lX2WuaS5WytoVJjL1NqfrC861a51 J+23pubYWgMOnggFHZVexyWlgXC7MXyO1ItnfIH1/XoESB/kM4N2Zzp8PSbidDBF7uA5 AOqMfIjkDwiCT5BKVY/ILLT5/BfKGxWj1HPWraylcQKlGFXNmWG8QDTCQzhZ4FnElES2 0tCRQlplPBXjVMHjwXGHFEIT7Kc0S+Kfy7dvju97qOON7k+lyz5KQxabveaEbWQmrcI9 011w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=TushYXc5; 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 g7-20020ac87f47000000b0042dd999bd19si161639qtk.63.2024.02.28.11.38.37 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 11:38:37 -0800 (PST) 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=TushYXc5; 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 8F75F3858299 for <ouuuleilei@gmail.com>; Wed, 28 Feb 2024 19:38:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F75F3858299 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709149117; bh=n5wLONU2u6JlIhFT8HIAB40eZiuJ42IeVNr0AnCccHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=TushYXc5C+gsK49PQWm4Y0cnhcPoKve0L9yVURC18Yw7YT4qCwP+A/w1EPJjbGblc ayWmax9J05oRnYX7yhgOS0qSP/bRTldJgElVo2WGuENfzqgxMzF7Qq1H3PWlW9QpYa LtY9q4RgUC8ZFAqVxtKuwFqHeAhZAoBfi+zamWbM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00641c01.pphosted.com (mx0b-00641c01.pphosted.com [205.220.177.146]) by sourceware.org (Postfix) with ESMTPS id A889B3858430; Wed, 28 Feb 2024 19:32:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A889B3858430 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 A889B3858430 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.177.146 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709148733; cv=none; b=q/XVIKIhmwL5i9eptkt0SMsEib9Vezr2tf5e6/mFbwLyNYOVVm3boNqe677J+Bh995NDcM9fhP6MYlBjUxOt0j4BGAJmnV6EFKSKLO1WiYkHXI8BhhtCnvEoWiYejrv6mNyIgPCMbe8NSFMLB0R5JsChdZQMvE1Mw/uFiU3biKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709148733; c=relaxed/simple; bh=ueYe/7FEcEzM4jDKaJtjXvZjWBm91DDzYCcCLh+8Oxg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ZR883V/Z3dqqGaPKPqlcGlXN783mC37j2G6gwgqzbJWWu9jJDk4iQm25Qa2sNbeVJBATH9O9OpaI0UoZBooz8w9cS1aE4UabNmAKG74pgcW5VLSgBlyxHQZ9Rvf55ehj2lf3Tvqan/atEpZZcJhcUiWIqFBR/axKgjLlWMA0Gog= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0247480.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41SJVMHQ022168; Wed, 28 Feb 2024 19:32:06 GMT Received: from mxout23.cac.washington.edu (mxout23.cac.washington.edu [140.142.32.140]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3whxdj4wbf-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 19:32:06 +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+UW24.02) with ESMTP id 41SJSpYb025225 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Feb 2024 11:28:51 -0800 X-Auth-Received: from kmatsui-ThinkPad-X1-Carbon-Gen-9.dhcp4.washington.edu ([10.154.74.128]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW24.02) with ESMTPSA id 41SJSoTY015429 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 11:28:51 -0800 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 v14 16/26] libstdc++: Optimize std::add_lvalue_reference compilation performance Date: Wed, 28 Feb 2024 11:26:21 -0800 Message-ID: <20240228192843.188979-17-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240228192843.188979-1-kmatsui@gcc.gnu.org> References: <20240221093616.4001742-1-kmatsui@gcc.gnu.org> <20240228192843.188979-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: 3e8fV_KcqBxjfgYH4Z-wfJ5tx3Qs0u3Y X-Proofpoint-ORIG-GUID: 3e8fV_KcqBxjfgYH4Z-wfJ5tx3Qs0u3Y 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-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 bulkscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1034 impostorscore=0 priorityscore=1501 mlxlogscore=577 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402280153 X-Spam-Status: No, score=-13.4 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, 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 <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: 1791501072374307009 X-GMAIL-MSGID: 1792172745407475621 |
Series |
Optimize more type traits
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Ken Matsui
Feb. 28, 2024, 7:26 p.m. UTC
This patch optimizes the compilation performance of
std::add_lvalue_reference by dispatching to the new
__add_lvalue_reference built-in trait.
libstdc++-v3/ChangeLog:
* include/std/type_traits (add_lvalue_reference): Use
__add_lvalue_reference built-in trait.
(__add_lvalue_reference_helper): Likewise.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
libstdc++-v3/include/std/type_traits | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 34475e6279a..17bf47d59d3 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1157,6 +1157,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; /// @cond undocumented +#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_lvalue_reference) + template<typename _Tp> + struct __add_lvalue_reference_helper + { using type = __add_lvalue_reference(_Tp); }; +#else template<typename _Tp, typename = void> struct __add_lvalue_reference_helper { using type = _Tp; }; @@ -1164,6 +1169,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp> struct __add_lvalue_reference_helper<_Tp, __void_t<_Tp&>> { using type = _Tp&; }; +#endif template<typename _Tp> using __add_lval_ref_t = typename __add_lvalue_reference_helper<_Tp>::type; @@ -1731,9 +1737,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif /// add_lvalue_reference +#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_lvalue_reference) + template<typename _Tp> + struct add_lvalue_reference + { using type = __add_lvalue_reference(_Tp); }; +#else template<typename _Tp> struct add_lvalue_reference { using type = __add_lval_ref_t<_Tp>; }; +#endif /// add_rvalue_reference template<typename _Tp>