[compiler-rt] b029384 - tsan: uninline RacyStacks::operator==

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 25 03:08:57 PDT 2021


Author: Dmitry Vyukov
Date: 2021-09-25T12:08:51+02:00
New Revision: b02938439dab1f282d28a4a94419de505f0f9c6e

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

LOG: tsan: uninline RacyStacks::operator==

It's only used during race reporting.
There is no point in polluting the main header file with it.

Reviewed By: xgupta

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
index 9785196d9434f..3a5c129509cdc 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
@@ -274,13 +274,7 @@ class ThreadContext final : public ThreadContextBase {
 
 struct RacyStacks {
   MD5Hash hash[2];
-  bool operator==(const RacyStacks &other) const {
-    if (hash[0] == other.hash[0] && hash[1] == other.hash[1])
-      return true;
-    if (hash[0] == other.hash[1] && hash[1] == other.hash[0])
-      return true;
-    return false;
-  }
+  bool operator==(const RacyStacks &other) const;
 };
 
 struct RacyAddress {

diff  --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
index 47746cbd4f6a3..1f0bcb35ae9f6 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
@@ -670,6 +670,14 @@ bool RestoreStack(Tid tid, EventType type, Sid sid, Epoch epoch, uptr addr,
 
 }  // namespace v3
 
+bool RacyStacks::operator==(const RacyStacks &other) const {
+  if (hash[0] == other.hash[0] && hash[1] == other.hash[1])
+    return true;
+  if (hash[0] == other.hash[1] && hash[1] == other.hash[0])
+    return true;
+  return false;
+}
+
 static bool FindRacyStacks(const RacyStacks &hash) {
   for (uptr i = 0; i < ctx->racy_stacks.Size(); i++) {
     if (hash == ctx->racy_stacks[i]) {


        


More information about the llvm-commits mailing list