]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Micro-optimization for std::addressof
authorJonathan Wakely <jwakely@redhat.com>
Fri, 25 Apr 2025 14:49:22 +0000 (15:49 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 25 Apr 2025 19:36:55 +0000 (20:36 +0100)
commitc91eb5a5c13f149126f53a7d54bab37ffba936b1
tree42f2d9f619505d9cff0e3e55135a746afeb0d0c3
parent0cb46354359cfb6c71cc0b66a72a89b9f666ec29
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.
libstdc++-v3/include/bits/move.h