diff --git a/libcxx/include/__assert b/libcxx/include/__assert --- a/libcxx/include/__assert +++ b/libcxx/include/__assert @@ -34,7 +34,10 @@ #endif #if _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ASSERT(expression, message) ((expression) ? (void)0 : ::std::__libcpp_assertion_handler(__FILE__, __LINE__, #expression, message)) +# define _LIBCPP_ASSERT(expression, message) \ + (__builtin_expect(static_cast(expression), 1) ? \ + (void)0 : \ + ::std::__libcpp_assertion_handler(__FILE__, __LINE__, #expression, message)) #else # define _LIBCPP_ASSERT(x, m) ((void)0) #endif