-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Revert "[tsan] Replace ALIGNED with alignas" #99240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mysterymath
merged 1 commit into
main
from
revert-98959-users/MaskRay/spr/tsan-replace-aligned-with-alignas
Jul 16, 2024
Merged
Revert "[tsan] Replace ALIGNED with alignas" #99240
mysterymath
merged 1 commit into
main
from
revert-98959-users/MaskRay/spr/tsan-replace-aligned-with-alignas
Jul 16, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 656f617.
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Daniel Thornburgh (mysterymath) ChangesReverts llvm/llvm-project#98959 Full diff: https://github.com/llvm/llvm-project/pull/99240.diff 9 Files Affected:
diff --git a/compiler-rt/lib/tsan/rtl/tsan_defs.h b/compiler-rt/lib/tsan/rtl/tsan_defs.h
index 270d441dc90b7..1ffa3d6aec40b 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_defs.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_defs.h
@@ -30,7 +30,7 @@
# define __MM_MALLOC_H
# include <emmintrin.h>
# include <smmintrin.h>
-# define VECTOR_ALIGNED alignas(16)
+# define VECTOR_ALIGNED ALIGNED(16)
typedef __m128i m128;
#else
# define VECTOR_ALIGNED
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index 9cab2a3727128..034ae3d322b56 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -208,7 +208,7 @@ struct AtExitCtx {
struct InterceptorContext {
// The object is 64-byte aligned, because we want hot data to be located
// in a single cache line if possible (it's accessed in every interceptor).
- alignas(64) LibIgnore libignore;
+ ALIGNED(64) LibIgnore libignore;
__sanitizer_sigaction sigactions[kSigCount];
#if !SANITIZER_APPLE && !SANITIZER_NETBSD
unsigned finalize_key;
@@ -220,7 +220,7 @@ struct InterceptorContext {
InterceptorContext() : libignore(LINKER_INITIALIZED), atexit_mu(MutexTypeAtExit), AtExitStack() {}
};
-alignas(64) static char interceptor_placeholder[sizeof(InterceptorContext)];
+static ALIGNED(64) char interceptor_placeholder[sizeof(InterceptorContext)];
InterceptorContext *interceptor_ctx() {
return reinterpret_cast<InterceptorContext*>(&interceptor_placeholder[0]);
}
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp b/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp
index befd6a369026d..5154662034c56 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cpp
@@ -76,7 +76,7 @@ struct DynamicAnnContext {
};
static DynamicAnnContext *dyn_ann_ctx;
-alignas(64) static char dyn_ann_ctx_placeholder[sizeof(DynamicAnnContext)];
+static char dyn_ann_ctx_placeholder[sizeof(DynamicAnnContext)] ALIGNED(64);
static void AddExpectRace(ExpectRace *list,
char *f, int l, uptr addr, uptr size, char *desc) {
diff --git a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
index 0705365d77427..e129e9af272f5 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
@@ -54,7 +54,7 @@ struct MapUnmapCallback {
}
};
-alignas(64) static char allocator_placeholder[sizeof(Allocator)];
+static char allocator_placeholder[sizeof(Allocator)] ALIGNED(64);
Allocator *allocator() {
return reinterpret_cast<Allocator*>(&allocator_placeholder);
}
@@ -75,7 +75,7 @@ struct GlobalProc {
internal_alloc_mtx(MutexTypeInternalAlloc) {}
};
-alignas(64) static char global_proc_placeholder[sizeof(GlobalProc)];
+static char global_proc_placeholder[sizeof(GlobalProc)] ALIGNED(64);
GlobalProc *global_proc() {
return reinterpret_cast<GlobalProc*>(&global_proc_placeholder);
}
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
index c8a66e60a69f1..07d83e1a9a9ff 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
@@ -46,7 +46,7 @@
namespace __tsan {
#if !SANITIZER_GO
-static char main_thread_state[sizeof(ThreadState)] alignas(
+static char main_thread_state[sizeof(ThreadState)] ALIGNED(
SANITIZER_CACHE_LINE_SIZE);
static ThreadState *dead_thread_state;
static pthread_key_t thread_state_key;
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
index bf29aa316f680..e5ebb65754b32 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
@@ -48,10 +48,11 @@ int (*on_finalize)(int);
#endif
#if !SANITIZER_GO && !SANITIZER_APPLE
-alignas(SANITIZER_CACHE_LINE_SIZE) THREADLOCAL __attribute__((tls_model(
- "initial-exec"))) char cur_thread_placeholder[sizeof(ThreadState)];
+__attribute__((tls_model("initial-exec")))
+THREADLOCAL char cur_thread_placeholder[sizeof(ThreadState)] ALIGNED(
+ SANITIZER_CACHE_LINE_SIZE);
#endif
-alignas(SANITIZER_CACHE_LINE_SIZE) static char ctx_placeholder[sizeof(Context)];
+static char ctx_placeholder[sizeof(Context)] ALIGNED(SANITIZER_CACHE_LINE_SIZE);
Context *ctx;
// Can be overriden by a front-end.
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
index f48be8e0a4fe0..de4ea0bb5f487 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
@@ -136,7 +136,7 @@ struct TidEpoch {
Epoch epoch;
};
-struct alignas(SANITIZER_CACHE_LINE_SIZE) TidSlot {
+struct TidSlot {
Mutex mtx;
Sid sid;
atomic_uint32_t raw_epoch;
@@ -153,10 +153,10 @@ struct alignas(SANITIZER_CACHE_LINE_SIZE) TidSlot {
}
TidSlot();
-};
+} ALIGNED(SANITIZER_CACHE_LINE_SIZE);
// This struct is stored in TLS.
-struct alignas(SANITIZER_CACHE_LINE_SIZE) ThreadState {
+struct ThreadState {
FastState fast_state;
int ignore_sync;
#if !SANITIZER_GO
@@ -234,7 +234,7 @@ struct alignas(SANITIZER_CACHE_LINE_SIZE) ThreadState {
const ReportDesc *current_report;
explicit ThreadState(Tid tid);
-};
+} ALIGNED(SANITIZER_CACHE_LINE_SIZE);
#if !SANITIZER_GO
#if SANITIZER_APPLE || SANITIZER_ANDROID
diff --git a/compiler-rt/lib/tsan/rtl/tsan_suppressions.cpp b/compiler-rt/lib/tsan/rtl/tsan_suppressions.cpp
index 0559df06e7e2e..70642124990d7 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_suppressions.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_suppressions.cpp
@@ -42,7 +42,7 @@ const char *__tsan_default_suppressions() {
namespace __tsan {
-alignas(64) static char suppression_placeholder[sizeof(SuppressionContext)];
+ALIGNED(64) static char suppression_placeholder[sizeof(SuppressionContext)];
static SuppressionContext *suppression_ctx = nullptr;
static const char *kSuppressionTypes[] = {
kSuppressionRace, kSuppressionRaceTop, kSuppressionMutex,
diff --git a/compiler-rt/lib/tsan/rtl/tsan_vector_clock.h b/compiler-rt/lib/tsan/rtl/tsan_vector_clock.h
index 51d98113d8e78..63b206302190d 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_vector_clock.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_vector_clock.h
@@ -34,7 +34,7 @@ class VectorClock {
VectorClock& operator=(const VectorClock& other);
private:
- VECTOR_ALIGNED Epoch clk_[kThreadSlotCount];
+ Epoch clk_[kThreadSlotCount] VECTOR_ALIGNED;
};
ALWAYS_INLINE Epoch VectorClock::Get(Sid sid) const {
|
Thanks, but could you update the commit message in the future? |
Sure, apologies for my haste. |
swift-ci
pushed a commit
to swiftlang/llvm-project
that referenced
this pull request
Jul 25, 2024
Reverts llvm#98959 Cherry-picked ahead of time to unblock auto-merger due to build failures rdar://132463432
yuxuanchen1997
pushed a commit
that referenced
this pull request
Jul 25, 2024
Summary: Reverts #98959 Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251556
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #98959