From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B4F9D3870899 for ; Thu, 13 Jun 2024 12:16:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B4F9D3870899 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B4F9D3870899 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718280983; cv=none; b=goYwv3e90pOpYEkHwkDvOcvFZU7YDzojia0yuFpmRHJM3plgp98Cs7hi42eDpS2uTHivENWxdUZRK8a/Jm9ZjulHQULqEHJxZCmYa66EWL0UrO3CL9I+56Vh83QZwvhmahPoF+OAHXrCvdsc5gtQ/fzbi1/y9/s5BzgWd533WXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718280983; c=relaxed/simple; bh=+10BIg4oYAvnXPCTr9cvXCdJmDdWtbgGVksRfFzJBL0=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=pqqAS71qTq6PY+cl55nF96VDhqOrM5/d8w8c/YVlqW8qs6G1HUPefWEFTkevITzxWtxGVVVG5G65QAGXAhO7vZ5C64P17RfSJnH1kxxB+rOGublmUhCW3V890K1RgQlwG9WGZOaE6uUWnbHWAMMHP1boN7Df5UVFF5ICnLeAF70= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718280981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Nx9ANepVv/0/aQs7oFOsjOyE22wU57fXSITNCa/ALoo=; b=AcpBUdSQueSqwkZmAj7hY9yBKPpK12FPuy59Tef6IAV+MK9A3X8+v5KQMhKHe8esv2H8Zv LviyL0X5BEqDlJM3ULUZRxCuBlNymUYYgevyIFXWQayJc8LcGKreedh0PEvwlhMOoLRQmx nG48dl8vewlXJj4YFdEn25rUpqSmNxk= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-332-m7t7_DkkMN6nxY1U34X2Kg-1; Thu, 13 Jun 2024 08:16:19 -0400 X-MC-Unique: m7t7_DkkMN6nxY1U34X2Kg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 29C0D19560BB; Thu, 13 Jun 2024 12:16:17 +0000 (UTC) Received: from localhost (unknown [10.39.192.128]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5D6A61955E91; Thu, 13 Jun 2024 12:16:16 +0000 (UTC) Date: Thu, 13 Jun 2024 13:16:14 +0100 From: Jonathan Wakely To: Ken Matsui Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: [PATCH v26 01/13] libstdc++: Optimize std::is_const compilation performance Message-ID: References: <20240510161405.194750-21-kmatsui@gcc.gnu.org> <20240511090130.248174-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 In-Reply-To: <20240511090130.248174-1-kmatsui@gcc.gnu.org> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_NONE,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 List-Id: On 11/05/24 02:01 -0700, Ken Matsui wrote: >This patch optimizes the compilation performance of std::is_const >by dispatching to the new __is_const built-in trait. OK, thanks. >libstdc++-v3/ChangeLog: > > * include/std/type_traits (is_const): Use __is_const built-in > trait. > (is_const_v): Likewise. > >Signed-off-by: Ken Matsui >--- > 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 b441bf9908f..8df0cf3ac3b 100644 >--- a/libstdc++-v3/include/std/type_traits >+++ b/libstdc++-v3/include/std/type_traits >@@ -835,6 +835,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > // Type properties. > > /// is_const >+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const) >+ template >+ struct is_const >+ : public __bool_constant<__is_const(_Tp)> >+ { }; >+#else > template > struct is_const > : public false_type { }; >@@ -842,6 +848,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > template > struct is_const<_Tp const> > : public true_type { }; >+#endif > > /// is_volatile > template >@@ -3331,10 +3338,15 @@ template > inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; > #endif > >+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const) >+template >+ inline constexpr bool is_const_v = __is_const(_Tp); >+#else > template > inline constexpr bool is_const_v = false; > template > inline constexpr bool is_const_v = true; >+#endif > > #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function) > template >-- >2.44.0 >