[libcxx-commits] [libcxx] Mark some std::string functions noinline. (PR #72869)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 27 12:13:39 PST 2023
================
@@ -1899,7 +1899,7 @@ private:
// to call the __init() functions as those are marked as inline which may
// result in over-aggressive inlining by the compiler, where our aim is
// to only inline the fast path code directly in the ctor.
- _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init_copy_ctor_external(const value_type* __s, size_type __sz);
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void __init_copy_ctor_external(const value_type* __s, size_type __sz);
----------------
ldionne wrote:
IMO comments like this one above explain why we have `_LIBCPP_NOINLINE` on this method:
```
// Slow path for the (inlined) copy constructor for 'long' strings.
// Always externally instantiated and not inlined.
```
Furthermore, these methods all have `_external` in their names which kind of explains why they're not inlined. I'm not sure we need more documentation.
https://github.com/llvm/llvm-project/pull/72869
More information about the libcxx-commits
mailing list