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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 17 06:47:36 PDT 2025


================
@@ -1161,6 +1161,24 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) {
   return this->__end_;
 }
 
+// This makes the compiler inline `__else()` if `__cond` is known to be false. Currently LLVM doesn't do that without
+// the `__builtin_constant_p`, since it considers `__else` unlikely even through it's known to be run.
+// See https://llvm.org/PR154292
----------------
ldionne wrote:

I think we need to tackle this comment. If this patch makes us do worse when PGO is enabled, that's something we need to fix.

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


More information about the libcxx-commits mailing list