[sanitizer] speed up the bitvector-based deadlock detector by ~15% (iterate over the currently held locks using the array, not the bitvector. Bitvector is not the best data structure to iterate over)
llvm-svn: 205168
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_bvgraph.h b/compiler-rt/lib/sanitizer_common/sanitizer_bvgraph.h
index 9a547d3..df72f1c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_bvgraph.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_bvgraph.h
@@ -61,18 +61,12 @@
}
// *EXPERIMENTAL*
- // Returns true if all edges from=>to exist.
+ // Returns true if an edge from=>to exist.
// This function does not use any global state except for 'this' itself,
// and thus can be called from different threads w/o locking.
// This would be racy.
// FIXME: investigate how much we can prove about this race being "benign".
- bool hasAllEdges(const BV &from, uptr to) {
- for (typename BV::Iterator it(from); it.hasNext(); ) {
- uptr idx = it.next();
- if (!v[idx].getBit(to)) return false;
- }
- return true;
- }
+ bool hasEdge(uptr from, uptr to) { return v[from].getBit(to); }
// Returns true if the edge from=>to was removed.
bool removeEdge(uptr from, uptr to) {