1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

Don't acquire the mutex during the destructor of PassRegistry.

This destructor is run as part of static program termination, and
so all ManagedStatics (including this lock) will have been
destroyed by llvm_shutdown.  Furthermore, if there is actually
a race condition during static program termination, then we are
just hiding a bug somewhere else, because other threads should
not be running at this point.

llvm-svn: 210717
This commit is contained in:
Zachary Turner 2014-06-11 23:03:31 +00:00
parent f72719e3d6
commit 4f8d07538b

View File

@ -73,7 +73,10 @@ void *PassRegistry::getImpl() const {
//
PassRegistry::~PassRegistry() {
sys::SmartScopedWriter<true> Guard(*Lock);
// Don't acquire the mutex here. This is destroyed during static execution of
// static destructors, after llvm_shutdown() has been called, so all instances
// of all ManagedStatics (including the Mutex), will have been destroyed as
// well.
PassRegistryImpl *Impl = static_cast<PassRegistryImpl*>(pImpl);
delete Impl;
pImpl = nullptr;