[compiler-rt] b988d8d - tsan: remove unnecessary brackets

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 03:11:50 PDT 2022


Author: Dmitry Vyukov
Date: 2022-07-21T12:11:44+02:00
New Revision: b988d8ddc29f8b058509d9cadd3ff9107b80e113

URL: https://github.com/llvm/llvm-project/commit/b988d8ddc29f8b058509d9cadd3ff9107b80e113
DIFF: https://github.com/llvm/llvm-project/commit/b988d8ddc29f8b058509d9cadd3ff9107b80e113.diff

LOG: tsan: remove unnecessary brackets

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D130236

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_rtl.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
index ef073ca32e573..825a9d791ecc4 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
@@ -210,17 +210,15 @@ static void DoResetImpl(uptr epoch) {
 // Clang does not understand locking all slots in the loop:
 // error: expecting mutex 'slot.mtx' to be held at start of each loop
 void DoReset(ThreadState* thr, uptr epoch) SANITIZER_NO_THREAD_SAFETY_ANALYSIS {
-  {
-    for (auto& slot : ctx->slots) {
-      slot.mtx.Lock();
-      if (UNLIKELY(epoch == 0))
-        epoch = ctx->global_epoch;
-      if (UNLIKELY(epoch != ctx->global_epoch)) {
-        // Epoch can't change once we've locked the first slot.
-        CHECK_EQ(slot.sid, 0);
-        slot.mtx.Unlock();
-        return;
-      }
+  for (auto& slot : ctx->slots) {
+    slot.mtx.Lock();
+    if (UNLIKELY(epoch == 0))
+      epoch = ctx->global_epoch;
+    if (UNLIKELY(epoch != ctx->global_epoch)) {
+      // Epoch can't change once we've locked the first slot.
+      CHECK_EQ(slot.sid, 0);
+      slot.mtx.Unlock();
+      return;
     }
   }
   DPrintf("#%d: DoReset epoch=%lu\n", thr ? thr->tid : -1, epoch);


        


More information about the llvm-commits mailing list