Skip to content

Commit 210ded1

Browse files
authored
Merge pull request #74270 from jckarter/move-only-tsan-test-require
Run moveonly checker + TSAN tests in a separate file.
2 parents 876c056 + 03e0cfd commit 210ded1

4 files changed

+38
-4
lines changed

test/SILOptimizer/moveonly_addresschecker.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// RUN: %target-swift-emit-sil -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s -Xllvm -sil-print-final-ossa-module | %FileCheck %s
22
// RUN: %target-swift-emit-sil -O -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s
3-
// RUN: %target-swift-emit-sil -sanitize=thread -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s -Xllvm -sil-print-final-ossa-module | %FileCheck %s
4-
// RUN: %target-swift-emit-sil -sanitize=thread -O -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s
53

64
// This file contains tests that used to crash due to verifier errors. It must
75
// be separate from moveonly_addresschecker_diagnostics since when we fail on

test/SILOptimizer/moveonly_addresschecker_destructure_through_deinit_diagnostics.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-swift-emit-sil -sil-verify-all -verify -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature MoveOnlyTuples %s
2-
// RUN: %target-swift-emit-sil -sanitize=thread -sil-verify-all -verify -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature MoveOnlyTuples %s
32

43
// This test validates that we properly emit errors if we partially invalidate
54
// through a type with a deinit.

test/SILOptimizer/moveonly_addresschecker_diagnostics.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-swift-emit-sil %s -O -sil-verify-all -verify -enable-experimental-feature MoveOnlyPartialReinitialization -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses
2-
// RUN: %target-swift-emit-sil -sanitize=thread %s -O -sil-verify-all -verify -enable-experimental-feature MoveOnlyPartialReinitialization -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses
32

43
//////////////////
54
// Declarations //
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// RUN: %target-swift-emit-sil -sanitize=thread -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s -Xllvm -sil-print-final-ossa-module | %FileCheck %s
2+
// RUN: %target-swift-emit-sil -sanitize=thread -O -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s
3+
// REQUIRES: OS=macOS
4+
5+
// This file contains tests that used to crash due to verifier errors. It must
6+
// be separate from moveonly_addresschecker_diagnostics since when we fail on
7+
// the diagnostics in that file, we do not actually run the verifier.
8+
9+
struct TestTrivialReturnValue : ~Copyable {
10+
var i: Int = 5
11+
12+
// We used to error on return buffer.
13+
consuming func drain() -> Int {
14+
let buffer = (consume self).i
15+
self = .init(i: 5)
16+
return buffer
17+
}
18+
}
19+
20+
21+
//////////////////////
22+
// MARK: Misc Tests //
23+
//////////////////////
24+
25+
func testAssertLikeUseDifferentBits() {
26+
struct S : ~Copyable {
27+
var s: [Int] = []
28+
var currentPosition = 5
29+
30+
// CHECK-LABEL: sil private @$s23moveonly_addresschecker30testAssertLikeUseDifferentBitsyyF1SL_V6resume2atySi_tF : $@convention(method) (Int, @inout S) -> () {
31+
// CHECK-NOT: destroy_addr
32+
// CHECK: } // end sil function '$s23moveonly_addresschecker30testAssertLikeUseDifferentBitsyyF1SL_V6resume2atySi_tF'
33+
mutating func resume(at index: Int) {
34+
assert(index >= currentPosition)
35+
currentPosition = index
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)