[llvm-commits] [llvm] r73777 - /llvm/trunk/include/llvm/Support/ManagedStatic.h
Owen Anderson
resistor at mac.com
Fri Jun 19 10:50:12 PDT 2009
Author: resistor
Date: Fri Jun 19 12:50:11 2009
New Revision: 73777
URL: http://llvm.org/viewvc/llvm-project?rev=73777&view=rev
Log:
Fences are expensive. Avoid doing them when we're not in multithreaded mode.
Modified:
llvm/trunk/include/llvm/Support/ManagedStatic.h
Modified: llvm/trunk/include/llvm/Support/ManagedStatic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ManagedStatic.h?rev=73777&r1=73776&r2=73777&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ManagedStatic.h (original)
+++ llvm/trunk/include/llvm/Support/ManagedStatic.h Fri Jun 19 12:50:11 2009
@@ -61,28 +61,28 @@
// Accessors.
C &operator*() {
void* tmp = Ptr;
- sys::MemoryFence();
+ if (llvm_is_multithreaded()) sys::MemoryFence();
if (!tmp) RegisterManagedStatic(object_creator<C>, object_deleter<C>);
return *static_cast<C*>(Ptr);
}
C *operator->() {
void* tmp = Ptr;
- sys::MemoryFence();
+ if (llvm_is_multithreaded()) sys::MemoryFence();
if (!tmp) RegisterManagedStatic(object_creator<C>, object_deleter<C>);
return static_cast<C*>(Ptr);
}
const C &operator*() const {
void* tmp = Ptr;
- sys::MemoryFence();
+ if (llvm_is_multithreaded()) sys::MemoryFence();
if (!tmp) RegisterManagedStatic(object_creator<C>, object_deleter<C>);
return *static_cast<C*>(Ptr);
}
const C *operator->() const {
void* tmp = Ptr;
- sys::MemoryFence();
+ if (llvm_is_multithreaded()) sys::MemoryFence();
if (!tmp) RegisterManagedStatic(object_creator<C>, object_deleter<C>);
return static_cast<C*>(Ptr);
More information about the llvm-commits
mailing list