Index: llvm/lib/Support/ManagedStatic.cpp =================================================================== --- llvm/lib/Support/ManagedStatic.cpp +++ llvm/lib/Support/ManagedStatic.cpp @@ -76,8 +76,12 @@ /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables. void llvm::llvm_shutdown() { - std::lock_guard Lock(*getManagedStaticMutex()); + std::recursive_mutex *mtx = getManagedStaticMutex(); + mtx->lock(); while (StaticList) StaticList->destroy(); + mtx->unlock(); + + delete mtx; }