Skip to content

Commit 476c5c1

Browse files
authored
Merge pull request #24202 from kubamracek/5.1-undo-disabled-tsan-in-coroutines
2 parents 7940973 + 0d2d3c3 commit 476c5c1

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,10 +1222,7 @@ IRGenSILFunction::IRGenSILFunction(IRGenModule &IGM, SILFunction *f)
12221222
CurFn->addFnAttr(llvm::Attribute::SanitizeAddress);
12231223
if (IGM.IRGen.Opts.Sanitizers & SanitizerKind::Thread) {
12241224
auto declContext = f->getDeclContext();
1225-
if (f->getLoweredFunctionType()->isCoroutine()) {
1226-
// Disable TSan in coroutines; the instrumentation currently interferes
1227-
// with coroutine structural invariants.
1228-
} else if (declContext && isa<DestructorDecl>(declContext)) {
1225+
if (declContext && isa<DestructorDecl>(declContext)) {
12291226
// Do not report races in deinit and anything called from it
12301227
// because TSan does not observe synchronization between retain
12311228
// count dropping to '0' and the object deinitialization.

test/IRGen/tsan-attributes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This test verifies that we add the function attributes used by TSan.
22

3-
// RUN: %target-swift-frontend -emit-ir -disable-llvm-optzns -sanitize=thread %s | %FileCheck %s -check-prefix=TSAN
3+
// RUN: %target-swift-frontend -emit-ir -sanitize=thread %s | %FileCheck %s -check-prefix=TSAN
44

55
// TSan is currently only supported on 64 bit mac and simulators.
66
// (We do not test the simulators here.)
@@ -22,5 +22,5 @@ public var x: Int {
2222
// TSAN-SAME: }
2323

2424
// TSAN: attributes [[COROUTINE_ATTRS]] =
25-
// TSAN-NOT: sanitize_address
25+
// TSAN-SAME: sanitize_thread
2626
// TSAN-SAME: }

0 commit comments

Comments
 (0)