From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92f.google.com (mail-ua1-x92f.google.com [IPv6:2607:f8b0:4864:20::92f]) by sourceware.org (Postfix) with ESMTPS id 1CA8C3858D3C for ; Tue, 7 May 2024 13:56:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1CA8C3858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.washington.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.washington.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1CA8C3858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::92f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715090180; cv=none; b=fP9+GnC15LQLRzMtOj5ZVdqhvAEANb4Jur69+8ME8Z+4ILRu74OM5qPRlfrJAmXmN+GEnyDM/ob2czwNudxv7vH5SfFtv7RrurJUkSDc2XxjnDtXQPW78odKJsMud8BW3oHyzx94SnaYlMk/on1QF7OHpNWC1bQ/IclKPRYOQTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715090180; c=relaxed/simple; bh=CuHGLN1sJtvO4FM346uDnUEaEuy4qroy6pQNacsctSs=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=WEfCTbsH7iY0o8yoqb0wBOwynaF8JQEs2gZQAqkpYLdrml+LE7mikwe0lUnxvCAUgGSa/tzGkNU6MS+uEtfs5q91aTb4gxLNfFQlYY/byX5X4qvYk/lywlavYCe4diaeT+CJiGV8CIw4IRPbbUgnMfCKEXru/ywUEAa/QzDu/Gs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ua1-x92f.google.com with SMTP id a1e0cc1a2514c-7f16ff3aa61so1247953241.1 for ; Tue, 07 May 2024 06:56:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1715090177; x=1715694977; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gpKzcOaLwiOQOItIrq1Se8r4NdeL4lN7P4DwlS4Z0/Y=; b=AhTc1QOV99ThARb5zbMbjGBzHbpAOF39ZyBRgG1VAdCIWOUwnck8qyxvE/QERLpDPk v3BvTvHjG4d7z9pVQrVHTqOcu2gU1RIB3bH/IIzq5aKr6zT5rhp0Vago1knC1OLW8Uyf 059gt7x4gQBVtaDs9qc628XJoj2Wzi5tcXocA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715090177; x=1715694977; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gpKzcOaLwiOQOItIrq1Se8r4NdeL4lN7P4DwlS4Z0/Y=; b=RGe1egemt3smKuEFY2DVHC760rePsE8fxvLjLN0wsZ7jKHiFbSIe1+JCYUeanyyOGp LIGLiVPHyo7VHQQ2rX6zcuSNEJg2lQB38GFhDcSKTP2BbKCK0qPw/LPa1Ns2R/R5WgxD cPIHhO6bo4B7JeEG+dP3jPtgix4Qimei/Zawu1aIEmwWe2tQCLJjLKiLEOdX5CMGoXWi F7oo3P7oHMNYf9RxtsdN8Xf7rcyqyThXm2y9oVsU9Ix+/ocjRg1GK2R9qdosSBLZLoBF 4DXVaJV4O7ZaXYCSEmGXP9D5kL8INx4UCaezMmqBEVplUaTCoSb6pd+iSBGOs6YccRlk h5mA== X-Forwarded-Encrypted: i=1; AJvYcCVzY3340lUPWOJUk0L4QrTYVPfOxiODxExIzNqmRDXMQWfctj0u2dadwdFqlLoShXRHh5j9jAxlKBkWH2SHisUsB7y7llk= X-Gm-Message-State: AOJu0YxwL9q5VsfrUB+Nchnhckz6tUUnAmGqjX8mPs2lnoBOQwFI7mzi DUqzDJSTc7FvNiYDX5eLzAq3m4fCoY3gj6xtZGqunbgJK0V89gBYv63pLb2FAzMKlHNpkP+d1YK TVE0QwcWoDYEliGylq7mOQiU4+CQjilIfhBg7 X-Google-Smtp-Source: AGHT+IEREi3NkLextKBUxvg8lyiMWr2IIavHCffdnSgmR4O//70BUI7rRj9wDzjYDBOYOhgWe1NmS7oRCF6YhgDHtvU= X-Received: by 2002:a05:6122:d9c:b0:4d8:7b33:c624 with SMTP id bc28-20020a0561220d9c00b004d87b33c624mr12399118vkb.0.1715090177398; Tue, 07 May 2024 06:56:17 -0700 (PDT) MIME-Version: 1.0 References: <20240502184529.97337-1-kmatsui@gcc.gnu.org> <20240502201549.459244-1-kmatsui@gcc.gnu.org> <20240502201549.459244-3-kmatsui@gcc.gnu.org> In-Reply-To: <20240502201549.459244-3-kmatsui@gcc.gnu.org> From: Ken Matsui Date: Tue, 7 May 2024 06:55:41 -0700 Message-ID: Subject: Re: [PATCH v18 02/26] libstdc++: Optimize std::is_const compilation performance To: Jonathan Wakely Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, jason@redhat.com, Ken Matsui Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: Hi Jonathan, Since __is_const, __is_volatile, and __is_pointer were approved, could you please review these patches for libstdc++? I guess that you already reviewed almost equivalent patches, but I wanted to make sure. Sincerely, Ken Matsui On Thu, May 2, 2024 at 1:16=E2=80=AFPM Ken Matsui wro= te: > > This patch optimizes the compilation performance of std::is_const > by dispatching to the new __is_const built-in trait. > > 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 =3D is_member_pointer<_Tp>::= value; > #endif > > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const) > +template > + inline constexpr bool is_const_v =3D __is_const(_Tp); > +#else > template > inline constexpr bool is_const_v =3D false; > template > inline constexpr bool is_const_v =3D true; > +#endif > > #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function) > template > -- > 2.44.0 >