[libc-commits] [libc] [libc] Add `__builtin_expect` tag on assert conditions; NFC (PR #99498)

via libc-commits libc-commits at lists.llvm.org
Thu Jul 18 10:08:04 PDT 2024


================
@@ -71,7 +71,7 @@ LIBC_INLINE void report_assertion_failure(const char *assertion,
 
 #define LIBC_ASSERT(COND)                                                      \
   do {                                                                         \
-    if (!(COND)) {                                                             \
+    if (LIBC_UNLIKELY(!(COND))) {                                              \
----------------
lntue wrote:

Can you also include `src/__support/macros/optimization.h` where these macros are defined and update cmake dependency?  Same for `libc/src/assert/assert.h`

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


More information about the libc-commits mailing list