[libcxx-commits] [libcxx] [libc++] Mark __{emplace, push}_back_slow_path as noinline (PR #94379)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 4 09:54:42 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

<details>
<summary>Changes</summary>

These are almost ceratinly intended to not be inlined. This significantly reduces code size when `push_back` and `emplace_back` are used heavily.

Fixes #<!-- -->94360


---
Full diff: https://github.com/llvm/llvm-project/pull/94379.diff


1 Files Affected:

- (modified) libcxx/include/vector (+3-2) 


``````````diff
diff --git a/libcxx/include/vector b/libcxx/include/vector
index cbfc2cefa1fd9..c542b3e70cdd1 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -844,10 +844,11 @@ private:
   }
 
   template <class _Up>
-  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI inline pointer __push_back_slow_path(_Up&& __x);
+  _LIBCPP_NOINLINE _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI inline pointer __push_back_slow_path(_Up&& __x);
 
   template <class... _Args>
-  _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI inline pointer __emplace_back_slow_path(_Args&&... __args);
+  _LIBCPP_NOINLINE _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI inline pointer
+  __emplace_back_slow_path(_Args&&... __args);
 
   // The following functions are no-ops outside of AddressSanitizer mode.
   // We call annotations for every allocator, unless explicitly disabled.

``````````

</details>


https://github.com/llvm/llvm-project/pull/94379


More information about the libcxx-commits mailing list