[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 10:28:20 PST 2024
https://github.com/fabio-d updated https://github.com/llvm/llvm-project/pull/81982
>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 1/2] [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.
>From e336099110718fd3e6d6b885b4030902ac1a0fda Mon Sep 17 00:00:00 2001
From: Fabio D'Urso <fdurso at google.com>
Date: Fri, 16 Feb 2024 19:24:13 +0100
Subject: [PATCH 2/2] fixup! [scudo] Move ALWAYS_INLINE up in tsd_shared's
ScopedTSD ctor
---
compiler-rt/lib/scudo/standalone/tsd_exclusive.h | 2 +-
compiler-rt/lib/scudo/standalone/tsd_shared.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
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 db5f6ec2094538..dade16dad9f2df 100644
--- a/compiler-rt/lib/scudo/standalone/tsd_shared.h
+++ b/compiler-rt/lib/scudo/standalone/tsd_shared.h
@@ -133,7 +133,7 @@ struct TSDRegistrySharedT {
}
private:
- TSD<Allocator> *getTSDAndLock() NO_THREAD_SAFETY_ANALYSIS {
+ ALWAYS_INLINE 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