[compiler-rt] [scudo] Move ALWAYS_INLINE up in tsd_shared's ScopedTSD ctor (PR #81982)

Fabio D'Urso via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 03:12:34 PST 2024


https://github.com/fabio-d created https://github.com/llvm/llvm-project/pull/81982

This PR should fix the performance regression that was introduced by #80061

>From 55126c03cef3043d48961ef2c5f49f27d68f7cc8 Mon Sep 17 00:00:00 2001
From: Fabio D'Urso <fdurso at google.com>
Date: Fri, 16 Feb 2024 11:20:16 +0100
Subject: [PATCH] [scudo] Move ALWAYS_INLINE up in tsd_shared's ScopedTSD ctor

To fix a performance regression introduced by #80061
---
 compiler-rt/lib/scudo/standalone/tsd_shared.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/lib/scudo/standalone/tsd_shared.h b/compiler-rt/lib/scudo/standalone/tsd_shared.h
index 0ac2be3d4c294d..db5f6ec2094538 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);
     }
@@ -133,7 +133,7 @@ struct TSDRegistrySharedT {
   }
 
 private:
-  ALWAYS_INLINE TSD<Allocator> *getTSDAndLock() NO_THREAD_SAFETY_ANALYSIS {
+  TSD<Allocator> *getTSDAndLock() NO_THREAD_SAFETY_ANALYSIS {
     TSD<Allocator> *TSD = getCurrentTSD();
     DCHECK(TSD);
     // Try to lock the currently associated context.



More information about the llvm-commits mailing list