[PATCH v27 2/3] libstdc++: Optimize std::add_lvalue_reference compilation performance

Ken Matsui kmatsui@cs.washington.edu
Thu Jun 13 13:58:13 GMT 2024


On Thu, Jun 13, 2024 at 6:56 AM Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Thu, 13 Jun 2024 at 14:41, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
> >
> > This patch optimizes the compilation performance of
> > std::add_lvalue_reference by dispatching to the new
> > __add_lvalue_reference built-in trait.
>
> Thanks for the quick updates. OK for trunk.

Thank you for your reviews!

>
> >
> > libstdc++-v3/ChangeLog:
> >
> >         * include/std/type_traits (__add_lval_ref_t): Use
> >         __add_lvalue_reference built-in trait.
> >
> > Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> > ---
> >  libstdc++-v3/include/std/type_traits | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> > index 0ef11292657..79983ea980a 100644
> > --- a/libstdc++-v3/include/std/type_traits
> > +++ b/libstdc++-v3/include/std/type_traits
> > @@ -1157,6 +1157,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> >      };
> >
> >    /// @cond undocumented
> > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_lvalue_reference)
> > +  template<typename _Tp>
> > +    using __add_lval_ref_t = __add_lvalue_reference(_Tp);
> > +#else
> >    template<typename _Tp, typename = void>
> >      struct __add_lvalue_reference_helper
> >      { using type = _Tp; };
> > @@ -1167,6 +1171,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> >
> >    template<typename _Tp>
> >      using __add_lval_ref_t = typename __add_lvalue_reference_helper<_Tp>::type;
> > +#endif
> >    /// @endcond
> >
> >    /// is_copy_constructible
> > --
> > 2.45.1
> >
>


More information about the Libstdc++ mailing list