[llvm] Always use pthread_rwlock on Apple platforms (PR #70151)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 18:12:57 PDT 2023
https://github.com/cooperp created https://github.com/llvm/llvm-project/pull/70151
pthread_rwlock is faster than std::shared_mutex, especially in heavily threaded code such as the Swift compiler.
rdar://117445844
>From 161d9beeb2443325d0cae16d50d9dda3245c5f62 Mon Sep 17 00:00:00 2001
From: Peter Cooper <peter_cooper at apple.com>
Date: Tue, 24 Oct 2023 18:07:54 -0700
Subject: [PATCH] Always use pthread_rwlock on Apple platforms. Its faster
than std::shared_mutex.
rdar://117445844
---
llvm/include/llvm/Support/RWMutex.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/llvm/include/llvm/Support/RWMutex.h b/llvm/include/llvm/Support/RWMutex.h
index 04cf3eb3d3aa7a7..32987c3b98f1cbc 100644
--- a/llvm/include/llvm/Support/RWMutex.h
+++ b/llvm/include/llvm/Support/RWMutex.h
@@ -19,12 +19,9 @@
#include <mutex>
#include <shared_mutex>
-// std::shared_timed_mutex is only available on macOS 10.12 and later.
-#if defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
-#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
+#if defined(__APPLE__)
#define LLVM_USE_RW_MUTEX_IMPL
#endif
-#endif
namespace llvm {
namespace sys {
More information about the llvm-commits
mailing list