mbox series

[v3,0/8] Optimize more type traits

Message ID 20240106050754.3054782-1-kmatsui@gcc.gnu.org
Headers show
Series Optimize more type traits | expand

Message

Ken Matsui Jan. 6, 2024, 5:05 a.m. UTC
Changes in v3:

- Rebased on top of master.
- Fixed __is_pointer in cpp_type_traits.h.

Changes in v2:

- Removed testsuite_tr1.h includes from the testcases.

---

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.  Here are new benchmark
results:

is_const: https://github.com/ken-matsui/gcc-bench/blob/main/is_const.md#sat-dec-23-090605-am-pst-2023

time: -4.36603%, peak memory: -0.300891%, total memory: -0.247934%

is_volatile_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_volatile_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_unbounded_array_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_unbounded_array_v.md#sat-dec-23-010046-pm-pst-2023

time: -1.50025%, peak memory: -1.07386%, total memory: -2.32394%

Ken Matsui (8):
  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

 gcc/cp/constraint.cc                          | 12 +++
 gcc/cp/cp-trait.def                           |  4 +
 gcc/cp/semantics.cc                           | 16 ++++
 gcc/testsuite/g++.dg/ext/has-builtin-1.C      | 12 +++
 gcc/testsuite/g++.dg/ext/is_const.C           | 20 +++++
 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 +++++
 libstdc++-v3/include/bits/cpp_type_traits.h   | 31 +++++++-
 libstdc++-v3/include/std/type_traits          | 73 +++++++++++++++++--
 10 files changed, 267 insertions(+), 9 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/ext/is_const.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

Comments

Ken Matsui Feb. 15, 2024, 5:07 a.m. UTC | #1
IIRC, all libstdc++ patches were already reviewed.  It would be great
if gcc patches were reviewed as well.  Thank you for your time.

Sincerely,
Ken Matsui

On Fri, Jan 5, 2024 at 9:08 PM Ken Matsui <kmatsui@gcc.gnu.org> wrote:
>
> Changes in v3:
>
> - Rebased on top of master.
> - Fixed __is_pointer in cpp_type_traits.h.
>
> Changes in v2:
>
> - Removed testsuite_tr1.h includes from the testcases.
>
> ---
>
> 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.  Here are new benchmark
> results:
>
> is_const: https://github.com/ken-matsui/gcc-bench/blob/main/is_const.md#sat-dec-23-090605-am-pst-2023
>
> time: -4.36603%, peak memory: -0.300891%, total memory: -0.247934%
>
> is_volatile_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_volatile_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_unbounded_array_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_unbounded_array_v.md#sat-dec-23-010046-pm-pst-2023
>
> time: -1.50025%, peak memory: -1.07386%, total memory: -2.32394%
>
> Ken Matsui (8):
>   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
>
>  gcc/cp/constraint.cc                          | 12 +++
>  gcc/cp/cp-trait.def                           |  4 +
>  gcc/cp/semantics.cc                           | 16 ++++
>  gcc/testsuite/g++.dg/ext/has-builtin-1.C      | 12 +++
>  gcc/testsuite/g++.dg/ext/is_const.C           | 20 +++++
>  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 +++++
>  libstdc++-v3/include/bits/cpp_type_traits.h   | 31 +++++++-
>  libstdc++-v3/include/std/type_traits          | 73 +++++++++++++++++--
>  10 files changed, 267 insertions(+), 9 deletions(-)
>  create mode 100644 gcc/testsuite/g++.dg/ext/is_const.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
>
> --
> 2.43.0
>