[PATCH] D12554: tsan: speed up race deduplication

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 13:43:02 PDT 2015


samsonov added inline comments.

================
Comment at: lib/tsan/rtl/tsan_interface_ann.cc:66
@@ -65,3 +65,3 @@
   ExpectRace *prev;
-  int hitcount;
-  int addcount;
+  atomic_uintptr_t hitcount;
+  atomic_uintptr_t addcount;
----------------
I don't see why you're not using atomic_uint32_t here, but leaving this to you.

================
Comment at: lib/tsan/rtl/tsan_interface_ann.cc:163
@@ -161,3 +162,3 @@
     (*unique_count)++;
-    if (race->*counter == 0)
+    if (atomic_load_relaxed(&(race->*counter)) == 0)
       continue;
----------------
Any reason for not hoisting all the loads from race->*counter here?

================
Comment at: lib/tsan/rtl/tsan_rtl_report.cc:384
@@ -391,2 +383,3 @@
           tid, (uptr)epoch, (uptr)ebegin, (uptr)eend, partidx);
-  InternalScopedBuffer<uptr> stack(kShadowStackSize);
+  Vector<uptr> stack(MBlockReportStack);
+  stack.Resize(hdr->stack0.size + 64);
----------------
Why do you need this change? If you want to improve performance and get rid of mmaps, consider changing `__tsan::VarSizeStackTrace` to somehow take ownership of the buffer passed into it. Or just make it use Vector internally. 


http://reviews.llvm.org/D12554





More information about the llvm-commits mailing list