https://gcc.gnu.org/g:c91eb5a5c13f149126f53a7d54bab37ffba936b1

commit r16-154-gc91eb5a5c13f149126f53a7d54bab37ffba936b1
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Fri Apr 25 15:49:22 2025 +0100

    libstdc++: Micro-optimization for std::addressof
    
    Currently std::addressof calls std::__addressof which uses
    __builtin_addressof. This leads to me prefering std::__addressof in some
    code, to avoid the extra hop. But it's not as though the implementation
    of std::__addressof is complicated and reusing it avoids any code
    duplication.
    
    So let's just make std::addressof use the built-in directly, and then we
    only need to use std::__addressof in C++98 code. (Transitioning existing
    uses of std::__addressof to std::addressof isn't included in this
    change.)
    
    The front end does fold std::addressof with -ffold-simple-inlines but
    this change still seems worthwhile.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/move.h (addressof): Use __builtin_addressof
            directly.

Diff:
---
 libstdc++-v3/include/bits/move.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index e91b003e6955..085ca074fc88 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -174,7 +174,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     [[__nodiscard__,__gnu__::__always_inline__]]
     inline _GLIBCXX17_CONSTEXPR _Tp*
     addressof(_Tp& __r) noexcept
-    { return std::__addressof(__r); }
+    { return __builtin_addressof(__r); }
 
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // 2598. addressof works on temporaries

Reply via email to