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.129.124]) by sourceware.org (Postfix) with ESMTPS id 82D253858D38 for ; Thu, 23 May 2024 22:15:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 82D253858D38 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 82D253858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716502506; cv=none; b=T5m1EwwF+8nFr1LUESbOfMDsZ1QDzLlGQ9GudMAp76Cer/Yw7iSZFs/sdWgDwbsoTxuLyAY6Cj3wIrLSrzdLucEGqNyUPp839xfcNTCKQTz6j2Crk5WAz/KWca+HfhxW2swtJUolgClFKhVM18D9ZBnur52D5sp7oyvjz0DTOZ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716502506; c=relaxed/simple; bh=uM89I+03lNkIQ3FKnQ3yAj/mGJdT2fxqaxniR5j3Oc4=; h=DKIM-Signature:From:Date:To:Subject:Message-ID:MIME-Version; b=EZUcloNfwgTQgb5FaGFc56TopNXinVzuwLkR9fSreJ1KZVY6RNFZCP8nVG7SvWJ+2gZu84eTnGhRjyChgYwe83iHK7nCEtLvdz1Xuwg/Tc2gfFsmG8bV5cipr0d5YIu+vkp+o/d6nIoPJkq3XN5VnVYd2NMUz/Qq9Sw5mgkvpOI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716502504; 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=vFUoCXpDYkb01sjrcQgvcJPHMZPgqK8ld+vWlbwdlWQ=; b=DBECDgEL/X4xDtcREXoDmcOg8mX+CzeOs9DskJwDLtEk7XZcOgJOMNIZ0YMKmz4eJqVcyL BH6KIawgOECIQZeBSiTJE5wID92XEFmpAX6tkwdFjcMP4Covr8jEJX1/DFbqCu+epj55qZ PwNnYAP2Lb2dsl3dLmkmY012dVhmepE= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-Ovhh5IqSOhqX3d58VzoXOw-1; Thu, 23 May 2024 18:15:02 -0400 X-MC-Unique: Ovhh5IqSOhqX3d58VzoXOw-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6ab9ce5a776so3248346d6.0 for ; Thu, 23 May 2024 15:15:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716502501; x=1717107301; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vFUoCXpDYkb01sjrcQgvcJPHMZPgqK8ld+vWlbwdlWQ=; b=XZ1C17eRdGqI4f3j+5FcZ78h9aiJ6T4N5m8lbHAWSUxY2hYTkuyBd3cOMPFUIpPufA h81e0nMjDqy16VtnqfcCRZBesjtF/IhYdUrKzIZT0tgoDhwhzCaxEfoO/PxldtLnKjGG S9qArFC8n6i2wNqsll4+cAJfh3p3YGH+UvLAMLC4FQ+XOBEtiJ/9GMWYGCeoX/mHnNX6 g8N4YnaQF2FCaL3bd+SfATYjoZZLlRp6jrv1/8ZYPwGqMxFYb4LrrSq8/GY6Sk3Ppwho NvuvxtD0ic/GSkdueSsGZWkx+hU3BS1i7+vfa/QtVdTiE5b3OmMkAgQgfKk0fRJjJzC0 BOdA== X-Gm-Message-State: AOJu0YyQj2+zTwe3d113hBVGnaYaR87e4aCzJoRSC5HVu7lL/92gcFIs MiDQRGdHHcPooOrTKi7X7x0yBCMRhzjHIw4oKsl2kk7MAXB2v4TCOG09karQJo1KR8r8HMzAtSj Gtadu/LgqCTdqOLdkLq4dg9VPD5U5HbG+n4lYFUHLKxog74Sl5UGFJPHh9R3gEbs= X-Received: by 2002:a05:6214:31a1:b0:6a0:a98a:4846 with SMTP id 6a1803df08f44-6abbbc3de5dmr4124846d6.17.1716502501322; Thu, 23 May 2024 15:15:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEg6cUlCsfG6v+Mh3yHTL1cRQY+n8kazFqjn15RshLUDjwK9H2rWnMa8n8S5E6G0XzuMlvvGA== X-Received: by 2002:a05:6214:31a1:b0:6a0:a98a:4846 with SMTP id 6a1803df08f44-6abbbc3de5dmr4124626d6.17.1716502500951; Thu, 23 May 2024 15:15:00 -0700 (PDT) Received: from [192.168.1.130] (ool-18bb2a2e.dyn.optonline.net. [24.187.42.46]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ac070c2ef5sm972176d6.17.2024.05.23.15.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 15:15:00 -0700 (PDT) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Thu, 23 May 2024 18:14:59 -0400 (EDT) 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 In-Reply-To: <20240511090130.248174-1-kmatsui@gcc.gnu.org> Message-ID: <21d0a54d-fc61-4782-b314-6626c273ef79@idea> References: <20240510161405.194750-21-kmatsui@gcc.gnu.org> <20240511090130.248174-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-12.7 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_SORBS_WEB,SPF_HELO_NONE,SPF_NONE,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 List-Id: On Sat, 11 May 2024, Ken Matsui wrote: > This patch optimizes the compilation performance of std::is_const > by dispatching to the new __is_const built-in trait. This patch series LGTM > > 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 > >