summaryrefslogtreecommitdiff
path: root/lib/VMCore/Type.cpp
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-02-11 06:41:30 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-02-11 06:41:30 +0000
commit9233b15d01ca62445bfc638f782243988c672e01 (patch)
treed6835dc476828ac488e8066c9f1bb6528be60d60 /lib/VMCore/Type.cpp
parent8c5ad3a5da7419af4d31963c3824836b5da52478 (diff)
downloadllvm-9233b15d01ca62445bfc638f782243988c672e01.tar.gz
llvm-9233b15d01ca62445bfc638f782243988c672e01.tar.bz2
llvm-9233b15d01ca62445bfc638f782243988c672e01.tar.xz
Fix some of the memcheck errors found in the JIT unittests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95856 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r--lib/VMCore/Type.cpp25
1 files changed, 1 insertions, 24 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 044de4fb39..cf851987df 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -507,30 +507,7 @@ void DerivedType::dropAllTypeUses() {
if (NumContainedTys != 0) {
// The type must stay abstract. To do this, we insert a pointer to a type
// that will never get resolved, thus will always be abstract.
- static Type *AlwaysOpaqueTy = 0;
- static PATypeHolder* Holder = 0;
- Type *tmp = AlwaysOpaqueTy;
- if (llvm_is_multithreaded()) {
- sys::MemoryFence();
- if (!tmp) {
- llvm_acquire_global_lock();
- tmp = AlwaysOpaqueTy;
- if (!tmp) {
- tmp = OpaqueType::get(getContext());
- PATypeHolder* tmp2 = new PATypeHolder(tmp);
- sys::MemoryFence();
- AlwaysOpaqueTy = tmp;
- Holder = tmp2;
- }
-
- llvm_release_global_lock();
- }
- } else if (!AlwaysOpaqueTy) {
- AlwaysOpaqueTy = OpaqueType::get(getContext());
- Holder = new PATypeHolder(AlwaysOpaqueTy);
- }
-
- ContainedTys[0] = AlwaysOpaqueTy;
+ ContainedTys[0] = getContext().pImpl->AlwaysOpaqueTy;
// Change the rest of the types to be Int32Ty's. It doesn't matter what we
// pick so long as it doesn't point back to this type. We choose something