diff options
author | Owen Anderson <resistor@mac.com> | 2009-06-18 16:17:42 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-06-18 16:17:42 +0000 |
commit | 1d36e4fa7c608809e7ab93536ea198d0fb63b7c6 (patch) | |
tree | b4a6c9e9cc0ebcb56af61213ccf56fff00310ec6 | |
parent | 3cfc62aa08c671c4f7fccd21e1ff1af2b07d34b6 (diff) |
Fix the double checked locking in this file too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73703 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/Type.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 0add0af3b8..b7adaddd9a 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -455,12 +455,14 @@ void DerivedType::dropAllTypeUses() { // that will never get resolved, thus will always be abstract. static Type *AlwaysOpaqueTy = 0; static PATypeHolder* Holder = 0; - if (!AlwaysOpaqueTy) { + Type *tmp = AlwaysOpaqueTy; + sys::MemoryFence(); + if (!tmp) { if (llvm_is_multithreaded()) { llvm_acquire_global_lock(); - - if (!AlwaysOpaqueTy) { - Type *tmp = OpaqueType::get(); + tmp = AlwaysOpaqueTy; + if (!tmp) { + tmp = OpaqueType::get(); PATypeHolder* tmp2 = new PATypeHolder(AlwaysOpaqueTy); sys::MemoryFence(); AlwaysOpaqueTy = tmp; |