[compiler-rt] 9b91bcf - tsan: removing redundant loop in ThreadClock::release()

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 19 08:30:09 PST 2020


Author: Daniel Fava
Date: 2020-02-19T17:30:00+01:00
New Revision: 9b91bcf6c6187afb488ef6e12b8ef245b6635fd2

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

LOG: tsan: removing redundant loop in ThreadClock::release()

The removed loop clears reused for entries at the tail of a SyncClock.
The loop is redundant since those entries were already cleared by the
immediately preceding loop, which iterates over all entries in the
SyncClock (including the tail entries).

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_clock.cpp b/compiler-rt/lib/tsan/rtl/tsan_clock.cpp
index 4b7aa0653da6..2aeb18df1ed2 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_clock.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_clock.cpp
@@ -222,8 +222,6 @@ void ThreadClock::release(ClockCache *c, SyncClock *dst) {
   // Clear 'acquired' flag in the remaining elements.
   if (nclk_ < dst->size_)
     CPP_STAT_INC(StatClockReleaseClearTail);
-  for (uptr i = nclk_; i < dst->size_; i++)
-    dst->elem(i).reused = 0;
   dst->release_store_tid_ = kInvalidTid;
   dst->release_store_reused_ = 0;
   // If we've acquired dst, remember this fact,


        


More information about the llvm-commits mailing list