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

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 15:28:13 PDT 2023


Author: cooperp
Date: 2023-10-26T15:28:09-07:00
New Revision: f74f2133d3c6f746563da101250fdb599aacfa94

URL: https://github.com/llvm/llvm-project/commit/f74f2133d3c6f746563da101250fdb599aacfa94
DIFF: https://github.com/llvm/llvm-project/commit/f74f2133d3c6f746563da101250fdb599aacfa94.diff

LOG: Always use pthread_rwlock on Apple platforms (#70151)

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

rdar://117445844

Added: 
    

Modified: 
    llvm/include/llvm/Support/RWMutex.h

Removed: 
    


################################################################################
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