forked from OSchip/llvm-project
Move the memory fences out of the path for single-threaded mode.
llvm-svn: 73775
This commit is contained in:
parent
2199dbc5ff
commit
81241a37fa
|
@ -198,9 +198,9 @@ static PassRegistrar *getPassRegistrar() {
|
|||
// Use double-checked locking to safely initialize the registrar when
|
||||
// we're running in multithreaded mode.
|
||||
PassRegistrar* tmp = PassRegistrarObj;
|
||||
sys::MemoryFence();
|
||||
if (!tmp) {
|
||||
if (llvm_is_multithreaded()) {
|
||||
if (llvm_is_multithreaded()) {
|
||||
sys::MemoryFence();
|
||||
if (!tmp) {
|
||||
llvm_acquire_global_lock();
|
||||
tmp = PassRegistrarObj;
|
||||
if (!tmp) {
|
||||
|
@ -209,10 +209,11 @@ static PassRegistrar *getPassRegistrar() {
|
|||
PassRegistrarObj = tmp;
|
||||
}
|
||||
llvm_release_global_lock();
|
||||
} else {
|
||||
PassRegistrarObj = new PassRegistrar();
|
||||
}
|
||||
} else if (!tmp) {
|
||||
PassRegistrarObj = new PassRegistrar();
|
||||
}
|
||||
|
||||
return PassRegistrarObj;
|
||||
}
|
||||
|
||||
|
|
|
@ -458,9 +458,9 @@ void DerivedType::dropAllTypeUses() {
|
|||
static Type *AlwaysOpaqueTy = 0;
|
||||
static PATypeHolder* Holder = 0;
|
||||
Type *tmp = AlwaysOpaqueTy;
|
||||
sys::MemoryFence();
|
||||
if (!tmp) {
|
||||
if (llvm_is_multithreaded()) {
|
||||
if (llvm_is_multithreaded()) {
|
||||
sys::MemoryFence();
|
||||
if (!tmp) {
|
||||
llvm_acquire_global_lock();
|
||||
tmp = AlwaysOpaqueTy;
|
||||
if (!tmp) {
|
||||
|
@ -472,12 +472,12 @@ void DerivedType::dropAllTypeUses() {
|
|||
}
|
||||
|
||||
llvm_release_global_lock();
|
||||
} else {
|
||||
AlwaysOpaqueTy = OpaqueType::get();
|
||||
Holder = new PATypeHolder(AlwaysOpaqueTy);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
AlwaysOpaqueTy = OpaqueType::get();
|
||||
Holder = new PATypeHolder(AlwaysOpaqueTy);
|
||||
}
|
||||
|
||||
ContainedTys[0] = AlwaysOpaqueTy;
|
||||
|
||||
// Change the rest of the types to be Int32Ty's. It doesn't matter what we
|
||||
|
|
Loading…
Reference in New Issue