aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-22 00:29:12 +0000
committerOwen Anderson <resistor@mac.com>2009-08-22 00:29:12 +0000
commit0b7401d3cdb4a2ecd266396ef1a77c8533a4476d (patch)
treeabe93b4025f7681b00a59e9ba8466285bfb30109 /lib/CodeGen/SelectionDAG
parentd99dda22f482a546ebf7692a7f2dd13162394da7 (diff)
downloadexternal_llvm-0b7401d3cdb4a2ecd266396ef1a77c8533a4476d.zip
external_llvm-0b7401d3cdb4a2ecd266396ef1a77c8533a4476d.tar.gz
external_llvm-0b7401d3cdb4a2ecd266396ef1a77c8533a4476d.tar.bz2
Ease contention on this lock by noticing that all writes to the VTs array will
be of (dynamically) constant values, so races on it are immaterial. We just need to ensure that at least one write has completed before return the pointer into it. With this change, parllc exhibits essentially no overhead on 403.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79708 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index f5de81b..91f7914 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5022,12 +5022,15 @@ 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()) {
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;
}
}