summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/PassRegistry.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2014-06-11 23:03:31 +0000
committerZachary Turner <zturner@google.com>2014-06-11 23:03:31 +0000
commita997d928fcc80b7f9ce894256e9377f205f00795 (patch)
tree9a929fa4a2142480f45d6dfa53492e13c710492b /llvm/lib/IR/PassRegistry.cpp
parentda70bfd82650d80ee43e9c6ff5f202da959ef09b (diff)
downloadbcm5719-llvm-a997d928fcc80b7f9ce894256e9377f205f00795.tar.gz
bcm5719-llvm-a997d928fcc80b7f9ce894256e9377f205f00795.zip
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
Diffstat (limited to 'llvm/lib/IR/PassRegistry.cpp')
-rw-r--r--llvm/lib/IR/PassRegistry.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/IR/PassRegistry.cpp b/llvm/lib/IR/PassRegistry.cpp
index 6a5bee2f57b..e85fabffb8c 100644
--- a/llvm/lib/IR/PassRegistry.cpp
+++ b/llvm/lib/IR/PassRegistry.cpp
@@ -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;
OpenPOWER on IntegriCloud