From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2e.google.com (mail-vs1-xe2e.google.com [IPv6:2607:f8b0:4864:20::e2e]) by sourceware.org (Postfix) with ESMTPS id DC3493858D1E for ; Thu, 7 Mar 2024 21:34:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC3493858D1E 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 DC3493858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::e2e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709847249; cv=none; b=IHc/qqvSUXRdv4r0DAJm/yu5Ud+TBatE76RwmLhVxbFNTe38uDBilc3swBA8SlvmgMVEFYG+6UTMk9P6O6sXUsAKQXY8cBag5AiighrXiJT7qoLyG3+JPoPL6TluwF+SMjtBG3ojJArErOghvJ3SZVcQdFHwlIQ2wrJBl/uKhYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709847249; c=relaxed/simple; bh=+eAzyYH2WXHCiICXOPfHiM/RxuROjT+j1cUXTYZQB4c=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=dvFjbL5e0JWBDOTyjH0bWQaH6sc2hcb0l4eShxbU+5VtVDPeFKy0hlHdQwWdAthrH0DaPbnTODYEBsUQoiySCQDFis/Yi/waBS3clXP1jJBQa5iW4SSpq/9sEpAdh6AfvpmNRuLypTwzubjQelJnEBu2y4U40WQNxbrz5C2KjpI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-vs1-xe2e.google.com with SMTP id ada2fe7eead31-47299367f78so457652137.0 for ; Thu, 07 Mar 2024 13:34:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1709847246; x=1710452046; 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=X6c/WLfFsL4SrlPJA/goXJDRIUSqG1pcvyMTAPLt1ao=; b=Y0ZD7ShM8xIIrQz5ol4pG8Y0t/hY5XmD6PMhbZscDoi65im3UCsFXDzvzLoyqQowRN JKa2VF5gCAp4EcMR0j5nPEyHQTxXZdtY+c/mmYuAoy74RRk6wnvJJITbW22BK/Lm54t2 diCxEZrFk5c41gEaM7ZBMocAifLZ0jy/Dh2qo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709847246; x=1710452046; 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=X6c/WLfFsL4SrlPJA/goXJDRIUSqG1pcvyMTAPLt1ao=; b=AiSpRfNEbJHe/yhgA9k9ARnD+ub+Cg5/p6Q3WVDru/EP4ZwbmdLAn30TXkdfm1yLz5 GNuWHIY6GSDhkZCie98ugmQlq2LgTAsjhclyrHKczm1aKczwYxfnavJ1TIjV3GliaVUx C9UqB1Eszct2tTuHeRIbX8UzX4MZzgJhAu6dbX5z32edynBugCEMO8Ac9Kd9uXhjZgUD uBzSBIZo7eHBJ4Uw044QbFHiHdd1GA4Xjy2fszqgWtyIRN+I0pU9dnW1Q4X7qjJZiXNC KoQvgpUIYtXu+ul00H8yHyGDxLQWIe/8ZweIr2G7JmrJs0dyApJLsXOX3yLcnRZ6XWIf SwvQ== X-Forwarded-Encrypted: i=1; AJvYcCXx9J13pK7/THjS59dvgJWQcZfw1ktvoa4CgPbUyUL6/GpzBPulgwWkGtYg1hukfWWdQWWHbhTTEzkpUF5q99u1Vbr0EHw= X-Gm-Message-State: AOJu0YwDPdrQlc1jGfKMe8QuWKwUYfeDl+dLNt/bOo+HG7OXBCv1R7tM wbqXsbPQTSqX4XRGP7EwxUXv9ltX1cJ/foBBhpwB2c0AWQ8jhDI+23XEJCp5bhkupngWlUGsa4a jw79MuC4C1lGmFrQWxjJiMIacrWetuM9+pAVy X-Google-Smtp-Source: AGHT+IE3H4sea0qq8nfX/+w/JpuWxudGOlFbXNETmoAV6EHatBuGAHZUNFFwUamenoKXDgin/tX4WPwIwka050xu5xk= X-Received: by 2002:a67:f642:0:b0:472:e726:e6df with SMTP id u2-20020a67f642000000b00472e726e6dfmr6587396vso.1.1709847246187; Thu, 07 Mar 2024 13:34:06 -0800 (PST) MIME-Version: 1.0 References: <20240221093616.4001742-1-kmatsui@gcc.gnu.org> <20240228192843.188979-1-kmatsui@gcc.gnu.org> In-Reply-To: <20240228192843.188979-1-kmatsui@gcc.gnu.org> From: Ken Matsui Date: Thu, 7 Mar 2024 13:33:30 -0800 Message-ID: Subject: Re: [PATCH v14 00/26] Optimize more type traits To: gcc-patches@gcc.gnu.org Cc: Patrick Palka , libstdc++@gcc.gnu.org, Ken Matsui Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Wed, Feb 28, 2024 at 11:32=E2=80=AFAM Ken Matsui w= rote: > > Hi, > > This patch series implements __is_const, __is_volatile, __is_pointer, > and __is_unbounded_array built-in traits, which were isolated from my > previous patch series "Optimize type traits compilation performance" > because they contained performance regression. I confirmed that this > patch series does not cause any performance regression. The main reason > of the performance regression were the exhaustiveness of the benchmarks > and the instability of the benchmark results. Also, this patch series > includes built-ins for add_pointer, remove_extent, remove_all_extents, > add_lvalue_reference, add_rvalue_reference, decay, rank, is_invocable, > and is_nothrow_invocable. Here are the benchmark results: Ping. Ok for trunk or maybe for 15? > > is_const: https://github.com/ken-matsui/gcc-bench/blob/main/is_const.md#s= at-dec-23-090605-am-pst-2023 > time: -4.36603%, peak memory: -0.300891%, total memory: -0.247934% > > is_const_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_const_v.= md#sat-jun-24-044815-am-pdt-2023 > time: -2.86467%, peak memory: -1.0654%, total memory: -1.62369% > > is_volatile: https://github.com/ken-matsui/gcc-bench/blob/main/is_volatil= e.md#sun-oct-22-091644-pm-pdt-2023 > time: -5.25164%, peak memory: -0.337971%, total memory: -0.247934% > > is_volatile_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_volat= ile_v.md#sat-dec-23-091518-am-pst-2023 > time: -4.06816%, peak memory: -0.609298%, total memory: -0.659134% > > is_pointer: https://github.com/ken-matsui/gcc-bench/blob/main/is_pointer.= md#sat-dec-23-124903-pm-pst-2023 > time: -2.47124%, peak memory: -2.98207%, total memory: -4.0811% > > is_pointer_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_pointe= r_v.md#sun-oct-22-122257-am-pdt-2023 > time: -4.71336%, peak memory: -2.25026%, total memory: -3.125% > > is_unbounded_array: https://github.com/ken-matsui/gcc-bench/blob/main/is_= unbounded_array.md#sun-oct-22-091644-pm-pdt-2023 > time: -6.33287%, peak memory: -0.602494%, total memory: -1.56035% > > is_unbounded_array_v: https://github.com/ken-matsui/gcc-bench/blob/main/i= s_unbounded_array_v.md#sat-dec-23-010046-pm-pst-2023 > time: -1.50025%, peak memory: -1.07386%, total memory: -2.32394% > > add_pointer_t: https://github.com/ken-matsui/gcc-bench/blob/main/add_poin= ter_t.md#wed-feb-28-060044-am-pst-2024 > time: -21.6673%, peak memory: -14.6666%, total memory: -17.4716% > > remove_extent_t: https://github.com/ken-matsui/gcc-bench/blob/main/remove= _extent_t.md#wed-feb-28-063021-am-pst-2024 > time: -14.4089%, peak memory: -2.71836%, total memory: -9.87013% > > remove_all_extents_t: https://github.com/ken-matsui/gcc-bench/blob/main/r= emove_all_extents_t.md#wed-feb-28-064716-am-pst-2024 > time: -28.8941%, peak memory: -16.6981%, total memory: -23.6088% > > add_lvalue_reference_t: https://github.com/ken-matsui/gcc-bench/blob/main= /add_lvalue_reference_t.md#wed-feb-28-070023-am-pst-2024 > time: -33.8827%, peak memory: -24.9292%, total memory: -25.3043% > > add_rvalue_reference_t: https://github.com/ken-matsui/gcc-bench/blob/main= /add_rvalue_reference_t.md#wed-feb-28-070701-am-pst-2024 > time: -23.9186%, peak memory: -17.1311%, total memory: -19.5891% > > decay_t: https://github.com/ken-matsui/gcc-bench/blob/main/decay_t.md#wed= -feb-28-072330-am-pst-2024 > time: -42.4076%, peak memory: -29.2077%, total memory: -33.0914% > > rank: https://github.com/ken-matsui/gcc-bench/blob/main/rank.md#wed-feb-2= 8-074917-am-pst-2024 > time: -33.7312%, peak memory: -27.5885%, total memory: -34.5736% > > rank_v: https://github.com/ken-matsui/gcc-bench/blob/main/rank_v.md#wed-f= eb-28-073632-am-pst-2024 > time: -40.7174%, peak memory: -16.4653%, total memory: -23.0131% > > is_invocable_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_invo= cable.md#wed-feb-28-111001-am-pst-2024 > time: -58.8307%, peak memory: -59.4966%, total memory: -59.8871% > (This benchmark is not exhaustive as my laptop crashed with larger benchm= arks) > > is_nothrow_invocable_v: https://github.com/ken-matsui/gcc-bench/blob/main= /is_nothrow_invocable.md#wed-feb-28-112414-am-pst-2024 > time: -70.4102%, peak memory: -62.5516%, total memory: -65.5853% > (This benchmark is not exhaustive as my laptop crashed with larger benchm= arks) > > Sincerely, > Ken Matsui > > Ken Matsui (26): > c++: Implement __is_const built-in trait > libstdc++: Optimize std::is_const compilation performance > c++: Implement __is_volatile built-in trait > libstdc++: Optimize std::is_volatile compilation performance > c++: Implement __is_pointer built-in trait > libstdc++: Optimize std::is_pointer compilation performance > c++: Implement __is_unbounded_array built-in trait > libstdc++: Optimize std::is_unbounded_array compilation performance > c++: Implement __add_pointer built-in trait > libstdc++: Optimize std::add_pointer compilation performance > c++: Implement __remove_extent built-in trait > libstdc++: Optimize std::remove_extent compilation performance > c++: Implement __remove_all_extents built-in trait > libstdc++: Optimize std::remove_all_extents compilation performance > c++: Implement __add_lvalue_reference built-in trait > libstdc++: Optimize std::add_lvalue_reference compilation performance > c++: Implement __add_rvalue_reference built-in trait > libstdc++: Optimize std::add_rvalue_reference compilation performance > c++: Implement __decay built-in trait > libstdc++: Optimize std::decay compilation performance > c++: Implement __rank built-in trait > libstdc++: Optimize std::rank compilation performance > c++: Implement __is_invocable built-in trait > libstdc++: Optimize std::is_invocable compilation performance > c++: Implement __is_nothrow_invocable built-in trait > libstdc++: Optimize std::is_nothrow_invocable compilation performance > > gcc/cp/constraint.cc | 27 ++ > gcc/cp/cp-trait.def | 13 + > gcc/cp/cp-tree.h | 2 + > gcc/cp/method.cc | 132 +++++++ > gcc/cp/semantics.cc | 92 ++++- > .../g++.dg/ext/add_lvalue_reference.C | 21 ++ > gcc/testsuite/g++.dg/ext/add_pointer.C | 39 ++ > .../g++.dg/ext/add_rvalue_reference.C | 20 + > gcc/testsuite/g++.dg/ext/decay.C | 22 ++ > gcc/testsuite/g++.dg/ext/has-builtin-1.C | 39 ++ > gcc/testsuite/g++.dg/ext/is_const.C | 20 + > gcc/testsuite/g++.dg/ext/is_invocable1.C | 349 ++++++++++++++++++ > gcc/testsuite/g++.dg/ext/is_invocable2.C | 139 +++++++ > gcc/testsuite/g++.dg/ext/is_invocable3.C | 51 +++ > gcc/testsuite/g++.dg/ext/is_invocable4.C | 33 ++ > .../g++.dg/ext/is_nothrow_invocable.C | 62 ++++ > gcc/testsuite/g++.dg/ext/is_pointer.C | 51 +++ > gcc/testsuite/g++.dg/ext/is_unbounded_array.C | 37 ++ > gcc/testsuite/g++.dg/ext/is_volatile.C | 20 + > gcc/testsuite/g++.dg/ext/rank.C | 24 ++ > gcc/testsuite/g++.dg/ext/remove_all_extents.C | 16 + > gcc/testsuite/g++.dg/ext/remove_extent.C | 16 + > libstdc++-v3/include/bits/cpp_type_traits.h | 31 +- > libstdc++-v3/include/std/type_traits | 142 ++++++- > .../is_invocable/incomplete_args_neg.cc | 1 + > .../20_util/is_invocable/incomplete_neg.cc | 1 + > .../incomplete_args_neg.cc | 1 + > .../is_nothrow_invocable/incomplete_neg.cc | 1 + > 28 files changed, 1389 insertions(+), 13 deletions(-) > create mode 100644 gcc/testsuite/g++.dg/ext/add_lvalue_reference.C > create mode 100644 gcc/testsuite/g++.dg/ext/add_pointer.C > create mode 100644 gcc/testsuite/g++.dg/ext/add_rvalue_reference.C > create mode 100644 gcc/testsuite/g++.dg/ext/decay.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_const.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable1.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable2.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable3.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_invocable4.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_nothrow_invocable.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_pointer.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_unbounded_array.C > create mode 100644 gcc/testsuite/g++.dg/ext/is_volatile.C > create mode 100644 gcc/testsuite/g++.dg/ext/rank.C > create mode 100644 gcc/testsuite/g++.dg/ext/remove_all_extents.C > create mode 100644 gcc/testsuite/g++.dg/ext/remove_extent.C > > -- > 2.44.0 >