[compiler-rt] 7c6cca4 - tsan: minor IgnoreSet refactoring

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 2 02:13:57 PDT 2021


Author: Dmitry Vyukov
Date: 2021-08-02T11:13:51+02:00
New Revision: 7c6cca4b6e75fb3feea5449325c9394ee87456c3

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

LOG: tsan: minor IgnoreSet refactoring

1. Move kMaxSize declaration to private section.
2. Inline Reset, it's trivial and called semi-frequently.

Reviewed By: melver

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

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_ignoreset.cpp
    compiler-rt/lib/tsan/rtl/tsan_ignoreset.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_ignoreset.cpp b/compiler-rt/lib/tsan/rtl/tsan_ignoreset.cpp
index a486784bb5f5..1fca1cf4f9fc 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_ignoreset.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_ignoreset.cpp
@@ -29,14 +29,6 @@ void IgnoreSet::Add(StackID stack_id) {
   stacks_[size_++] = stack_id;
 }
 
-void IgnoreSet::Reset() {
-  size_ = 0;
-}
-
-uptr IgnoreSet::Size() const {
-  return size_;
-}
-
 StackID IgnoreSet::At(uptr i) const {
   CHECK_LT(i, size_);
   CHECK_LE(size_, kMaxSize);

diff  --git a/compiler-rt/lib/tsan/rtl/tsan_ignoreset.h b/compiler-rt/lib/tsan/rtl/tsan_ignoreset.h
index b9e56ccb4b6c..4e2511291ce4 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_ignoreset.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_ignoreset.h
@@ -19,15 +19,14 @@ namespace __tsan {
 
 class IgnoreSet {
  public:
-  static const uptr kMaxSize = 16;
-
   IgnoreSet();
   void Add(StackID stack_id);
-  void Reset();
-  uptr Size() const;
+  void Reset() { size_ = 0; }
+  uptr Size() const { return size_; }
   StackID At(uptr i) const;
 
  private:
+  static constexpr uptr kMaxSize = 16;
   uptr size_;
   StackID stacks_[kMaxSize];
 };


        


More information about the llvm-commits mailing list