Index: llvm/lib/Support/ManagedStatic.cpp =================================================================== --- llvm/lib/Support/ManagedStatic.cpp +++ llvm/lib/Support/ManagedStatic.cpp @@ -18,16 +18,10 @@ using namespace llvm; static const ManagedStaticBase *StaticList = nullptr; -static std::recursive_mutex *ManagedStaticMutex = nullptr; -static llvm::once_flag mutex_init_flag; - -static void initializeMutex() { - ManagedStaticMutex = new std::recursive_mutex(); -} static std::recursive_mutex *getManagedStaticMutex() { - llvm::call_once(mutex_init_flag, initializeMutex); - return ManagedStaticMutex; + static std::recursive_mutex m; + return &m; } void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(),