[compiler-rt] cc67386 - [scudo] Add ALWAYS_INLINE to ScopedTSD ctor (#81982)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 10:48:11 PST 2024


Author: Fabio D'Urso
Date: 2024-02-16T19:48:07+01:00
New Revision: cc673867d97aeb1151da5f7f0dc59d47eb384b45

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

LOG: [scudo] Add ALWAYS_INLINE to ScopedTSD ctor (#81982)

Fix for performance regression introduced by #80061 that slowed
down Fuchsia's MallocFree microbenchmark by 3.5 - 8%

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/tsd_exclusive.h
    compiler-rt/lib/scudo/standalone/tsd_shared.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tsd_exclusive.h b/compiler-rt/lib/scudo/standalone/tsd_exclusive.h
index 5d8c7e4b8dd732..a58ba6505089ff 100644
--- a/compiler-rt/lib/scudo/standalone/tsd_exclusive.h
+++ b/compiler-rt/lib/scudo/standalone/tsd_exclusive.h
@@ -30,7 +30,7 @@ template <class Allocator> struct TSDRegistryExT {
   using ThisT = TSDRegistryExT<Allocator>;
 
   struct ScopedTSD {
-    ScopedTSD(ThisT &TSDRegistry) {
+    ALWAYS_INLINE ScopedTSD(ThisT &TSDRegistry) {
       CurrentTSD = TSDRegistry.getTSDAndLock(&UnlockRequired);
       DCHECK_NE(CurrentTSD, nullptr);
     }

diff  --git a/compiler-rt/lib/scudo/standalone/tsd_shared.h b/compiler-rt/lib/scudo/standalone/tsd_shared.h
index 0ac2be3d4c294d..dade16dad9f2df 100644
--- a/compiler-rt/lib/scudo/standalone/tsd_shared.h
+++ b/compiler-rt/lib/scudo/standalone/tsd_shared.h
@@ -29,7 +29,7 @@ struct TSDRegistrySharedT {
   using ThisT = TSDRegistrySharedT<Allocator, TSDsArraySize, DefaultTSDCount>;
 
   struct ScopedTSD {
-    ScopedTSD(ThisT &TSDRegistry) {
+    ALWAYS_INLINE ScopedTSD(ThisT &TSDRegistry) {
       CurrentTSD = TSDRegistry.getTSDAndLock();
       DCHECK_NE(CurrentTSD, nullptr);
     }


        


More information about the llvm-commits mailing list