[gcc r15-1250] libstdc++: Optimize std::remove_all_extents compilation performance

Ken Matsui kmatsui@gcc.gnu.org
Thu Jun 13 12:58:25 GMT 2024


https://gcc.gnu.org/g:66f5bebd126657ec4b430fa9bc4b8557485f469d

commit r15-1250-g66f5bebd126657ec4b430fa9bc4b8557485f469d
Author: Ken Matsui <kmatsui@gcc.gnu.org>
Date:   Wed Feb 14 22:47:05 2024 -0800

    libstdc++: Optimize std::remove_all_extents compilation performance
    
    This patch optimizes the compilation performance of
    std::remove_all_extents by dispatching to the new
    __remove_all_extents built-in trait.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/type_traits (remove_all_extents): Use
            __remove_all_extents built-in trait.
    
    Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
    Reviewed-by: Patrick Palka <ppalka@redhat.com>
    Reviewed-by: Jonathan Wakely <jwakely@redhat.com>

Diff:
---
 libstdc++-v3/include/std/type_traits | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 02d7a3e50171..23432ac43ac6 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -2097,6 +2097,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
   /// remove_all_extents
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents)
+  template<typename _Tp>
+    struct remove_all_extents
+    { using type = __remove_all_extents(_Tp); };
+#else
   template<typename _Tp>
     struct remove_all_extents
     { using type = _Tp; };
@@ -2108,6 +2113,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<typename _Tp>
     struct remove_all_extents<_Tp[]>
     { using type = typename remove_all_extents<_Tp>::type; };
+#endif
 
 #if __cplusplus > 201103L
   /// Alias template for remove_extent


More information about the Gcc-cvs mailing list