Skip to content

Commit 7f2e9b1

Browse files
Revert "[libc++] Mark __{emplace,push}_back_slow_path as noinline (#94379)"
This reverts commit 1bafd02. This breaks the LLDB data formatters which means these failures show up on every premerge run. Reverting for now until fixing the LLDB formatters can be coordinated with a relanding.
1 parent b87f1b2 commit 7f2e9b1

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

libcxx/include/__vector/vector.h

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,24 +1161,6 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) {
11611161
return this->__end_;
11621162
}
11631163

1164-
// This makes the compiler inline `__else()` if `__cond` is known to be false. Currently LLVM doesn't do that without
1165-
// the `__builtin_constant_p`, since it considers `__else` unlikely even through it's known to be run.
1166-
// See https://llvm.org/PR154292
1167-
template <class _If, class _Else>
1168-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __if_likely_else(bool __cond, _If __if, _Else __else) {
1169-
if (__builtin_constant_p(__cond)) {
1170-
if (__cond)
1171-
__if();
1172-
else
1173-
__else();
1174-
} else {
1175-
if (__cond) [[__likely__]]
1176-
__if();
1177-
else
1178-
__else();
1179-
}
1180-
}
1181-
11821164
template <class _Tp, class _Allocator>
11831165
template <class... _Args>
11841166
_LIBCPP_CONSTEXPR_SINCE_CXX20 inline
@@ -1189,14 +1171,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline
11891171
#endif
11901172
vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
11911173
pointer __end = this->__end_;
1192-
std::__if_likely_else(
1193-
__end < this->__cap_,
1194-
[&] {
1195-
__emplace_back_assume_capacity(std::forward<_Args>(__args)...);
1196-
++__end;
1197-
},
1198-
[&] { __end = __emplace_back_slow_path(std::forward<_Args>(__args)...); });
1199-
1174+
if (__end < this->__cap_) {
1175+
__emplace_back_assume_capacity(std::forward<_Args>(__args)...);
1176+
++__end;
1177+
} else {
1178+
__end = __emplace_back_slow_path(std::forward<_Args>(__args)...);
1179+
}
12001180
this->__end_ = __end;
12011181
#if _LIBCPP_STD_VER >= 17
12021182
return *(__end - 1);

0 commit comments

Comments
 (0)