[compiler-rt] r335322 - tsan: fix deficiency in MutexReadOrWriteUnlock

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 22 01:27:52 PDT 2018


Author: dvyukov
Date: Fri Jun 22 01:27:52 2018
New Revision: 335322

URL: http://llvm.org/viewvc/llvm-project?rev=335322&view=rev
Log:
tsan: fix deficiency in MutexReadOrWriteUnlock

MutexUnlock uses ReleaseStore on s->clock, which is the right thing to do.
However MutexReadOrWriteUnlock for writers uses Release on s->clock.
Make MutexReadOrWriteUnlock also use ReleaseStore for consistency and performance.
Unfortunately, I don't think any test can detect this as this only potentially
affects performance.


Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_mutex.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_mutex.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_mutex.cc?rev=335322&r1=335321&r2=335322&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_mutex.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_mutex.cc Fri Jun 22 01:27:52 2018
@@ -361,7 +361,7 @@ void MutexReadOrWriteUnlock(ThreadState
     if (s->recursion == 0) {
       StatInc(thr, StatMutexUnlock);
       s->owner_tid = SyncVar::kInvalidTid;
-      ReleaseImpl(thr, pc, &s->clock);
+      ReleaseStoreImpl(thr, pc, &s->clock);
     } else {
       StatInc(thr, StatMutexRecUnlock);
     }




More information about the llvm-commits mailing list