summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-22 06:32:36 +0000
committerOwen Anderson <resistor@mac.com>2009-08-22 06:32:36 +0000
commit63010bb65a609d8acc7cd8cc49c2fa67d81c3264 (patch)
tree64322d8eff92bcb1375668ce187d98e28a3d9b2e /llvm/lib
parentcd44daddf6adbd688489e07a5ac5d8554590c18d (diff)
downloadbcm5719-llvm-63010bb65a609d8acc7cd8cc49c2fa67d81c3264.tar.gz
bcm5719-llvm-63010bb65a609d8acc7cd8cc49c2fa67d81c3264.zip
Reapply r79708 with the appropriate fix for the case that still requires locking.
llvm-svn: 79731
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 72f21125263..6ce30f6864b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5022,12 +5022,16 @@ static ManagedStatic<sys::SmartMutex<true> > VTMutex;
/// getValueTypeList - Return a pointer to the specified value type.
///
const EVT *SDNode::getValueTypeList(EVT VT) {
- sys::SmartScopedLock<true> Lock(*VTMutex);
if (VT.isExtended()) {
+ sys::SmartScopedLock<true> Lock(*VTMutex);
return &(*EVTs->insert(VT).first);
} else {
+ // All writes to this location will have the same value, so it's ok
+ // to race on it. We only need to ensure that at least one write has
+ // succeeded before we return the pointer into the array.
VTs[VT.getSimpleVT().SimpleTy] = VT;
- return &VTs[VT.getSimpleVT().SimpleTy];
+ sys::MemoryFence();
+ return VTs + VT.getSimpleVT().SimpleTy;
}
}
OpenPOWER on IntegriCloud