[llvm] Always use pthread_rwlock on Apple platforms (PR #70151)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 18:14:04 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: None (cooperp)

<details>
<summary>Changes</summary>

pthread_rwlock is faster than std::shared_mutex, especially in heavily threaded code such as the Swift compiler.

rdar://117445844

---
Full diff: https://github.com/llvm/llvm-project/pull/70151.diff


1 Files Affected:

- (modified) llvm/include/llvm/Support/RWMutex.h (+1-4) 


``````````diff
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 {

``````````

</details>


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


More information about the llvm-commits mailing list