Skip to content

Commit 8e3fa55

Browse files
committed
Fix a concurrency irgen test for differences between main and release/6.2
1 parent abc2e30 commit 8e3fa55

File tree

1 file changed

+49
-15
lines changed

1 file changed

+49
-15
lines changed

test/Concurrency/isolation_macro_ir.swift

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
// This test makes sure that we can properly fold the mask for the witness table
55
// when we have a #isolation.
66

7+
// PLEASE READ THIS! On 6.2, we do not eliminate hops for
8+
// nonisolated(nonsending) to be conservative. So we have to pattern match
9+
// differently than on main!
10+
711
// REQUIRES: concurrency
812
// REQUIRES: CODEGENERATOR=AArch64
913
// REQUIRES: PTRSIZE=64
@@ -22,11 +26,21 @@ func implicitParam(_ x: (any Actor)? = #isolation) {
2226

2327
// #isolation via direct usage
2428
//
25-
// TBI: define swifttailcc void @"$s18isolation_macro_ir46nonisolatedNonsendingUsePoundIsolationDirectlyyyYaF"(ptr swiftasync %0, i64 %1, i64 [[SECOND_WORD:%.*]])
29+
// TBI: define internal swifttailcc void @"$s18isolation_macro_ir46nonisolatedNonsendingUsePoundIsolationDirectlyyyYaFTY0_"(ptr swiftasync [[ASYNC_CONTEXT:%.*]])
30+
// TBI: [[ASYNC_FRAME_PTR:%.*]] = getelementptr inbounds i8, ptr [[ASYNC_CONTEXT]], i32 16
31+
// TBI: [[SECOND_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 3
32+
// TBI: [[SECOND_WORD:%.*]] = load i64, ptr [[SECOND_WORD_ADDR]]
33+
// TBI: [[FIRST_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 2
34+
// TBI: [[FIRST_WORD:%.*]] = load i64, ptr [[FIRST_WORD_ADDR]]
2635
// TBI: [[MASKED_SECOND_WORD:%.*]] = and i64 [[SECOND_WORD]], -3458764513820540929
27-
// TBI: call swiftcc void @"$s18isolation_macro_ir8useActor3isoyScA_pSg_tF"(i64 %1, i64 [[MASKED_SECOND_WORD]])
36+
// TBI: call swiftcc void @"$s18isolation_macro_ir8useActor3isoyScA_pSg_tF"(i64 [[FIRST_WORD]], i64 [[MASKED_SECOND_WORD]])
2837

29-
// NO-TBI: define swifttailcc void @"$s18isolation_macro_ir46nonisolatedNonsendingUsePoundIsolationDirectlyyyYaF"(ptr swiftasync %0, i64 [[FIRST_WORD:%.*]], i64 [[SECOND_WORD:%.*]])
38+
// NO-TBI: define internal swifttailcc void @"$s18isolation_macro_ir46nonisolatedNonsendingUsePoundIsolationDirectlyyyYaFTY0_"(ptr swiftasync [[ASYNC_CONTEXT:%.*]])
39+
// NO-TBI: [[ASYNC_FRAME_PTR:%.*]] = getelementptr inbounds i8, ptr [[ASYNC_CONTEXT]], i32 16
40+
// NO-TBI: [[SECOND_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 3
41+
// NO-TBI: [[SECOND_WORD:%.*]] = load i64, ptr [[SECOND_WORD_ADDR]]
42+
// NO-TBI: [[FIRST_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 2
43+
// NO-TBI: [[FIRST_WORD:%.*]] = load i64, ptr [[FIRST_WORD_ADDR]]
3044
// NO-TBI: [[MASKED_SECOND_WORD:%.*]] = and i64 [[SECOND_WORD]], -4
3145
// NO-TBI: call swiftcc void @"$s18isolation_macro_ir8useActor3isoyScA_pSg_tF"(i64 [[FIRST_WORD]], i64 [[MASKED_SECOND_WORD]])
3246

@@ -37,13 +51,23 @@ public nonisolated(nonsending) func nonisolatedNonsendingUsePoundIsolationDirect
3751

3852
// #isolation via default arg
3953
//
40-
// TBI: define swifttailcc void @"$s18isolation_macro_ir45nonisolatedNonsendingPoundIsolationDefaultArgyyYaF"(ptr swiftasync {{%.*}}, i64 {{%.*}}, i64 [[WORD_2:%.*]])
41-
// TBI: [[MASKED_WORD_2:%.*]] = and i64 [[WORD_2]], -3458764513820540929
42-
// TBI: call swiftcc void @"$s18isolation_macro_ir13implicitParamyyScA_pSgF"(i64 {{%.*}}, i64 [[MASKED_WORD_2]])
54+
// TBI: define internal swifttailcc void @"$s18isolation_macro_ir45nonisolatedNonsendingPoundIsolationDefaultArgyyYaFTY0_"(ptr swiftasync [[ASYNC_CONTEXT:%.*]])
55+
// TBI: [[ASYNC_FRAME_PTR:%.*]] = getelementptr inbounds i8, ptr [[ASYNC_CONTEXT]], i32 16
56+
// TBI: [[SECOND_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 2
57+
// TBI: [[SECOND_WORD:%.*]] = load i64, ptr [[SECOND_WORD_ADDR]]
58+
// TBI: [[FIRST_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 1
59+
// TBI: [[FIRST_WORD:%.*]] = load i64, ptr [[FIRST_WORD_ADDR]]
60+
// TBI: [[MASKED_SECOND_WORD:%.*]] = and i64 [[SECOND_WORD]], -3458764513820540929
61+
// TBI: call swiftcc void @"$s18isolation_macro_ir13implicitParamyyScA_pSgF"(i64 [[FIRST_WORD]], i64 [[MASKED_SECOND_WORD]])
4362

44-
// NO-TBI: define swifttailcc void @"$s18isolation_macro_ir45nonisolatedNonsendingPoundIsolationDefaultArgyyYaF"(ptr swiftasync %0, i64 [[WORD_1:%.*]], i64 [[WORD_2:%.*]])
45-
// NO-TBI: [[MASKED_WORD_2:%.*]] = and i64 [[WORD_2]], -4
46-
// NO-TBI: call swiftcc void @"$s18isolation_macro_ir13implicitParamyyScA_pSgF"(i64 {{%.*}}, i64 [[MASKED_WORD_2]])
63+
// NO-TBI: define internal swifttailcc void @"$s18isolation_macro_ir45nonisolatedNonsendingPoundIsolationDefaultArgyyYaFTY0_"(ptr swiftasync [[ASYNC_CONTEXT:%.*]])
64+
// NO-TBI: [[ASYNC_FRAME_PTR:%.*]] = getelementptr inbounds i8, ptr [[ASYNC_CONTEXT]], i32 16
65+
// NO-TBI: [[SECOND_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 2
66+
// NO-TBI: [[SECOND_WORD:%.*]] = load i64, ptr [[SECOND_WORD_ADDR]]
67+
// NO-TBI: [[FIRST_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 1
68+
// NO-TBI: [[FIRST_WORD:%.*]] = load i64, ptr [[FIRST_WORD_ADDR]]
69+
// NO-TBI: [[MASKED_SECOND_WORD:%.*]] = and i64 [[SECOND_WORD]], -4
70+
// NO-TBI: call swiftcc void @"$s18isolation_macro_ir13implicitParamyyScA_pSgF"(i64 [[FIRST_WORD]], i64 [[MASKED_SECOND_WORD]])
4771
public nonisolated(nonsending) func nonisolatedNonsendingPoundIsolationDefaultArg() async {
4872
implicitParam()
4973
}
@@ -52,13 +76,23 @@ public nonisolated(nonsending) func nonisolatedNonsendingPoundIsolationDefaultAr
5276
public nonisolated(nonsending) func calleeFunction() async {
5377
}
5478

55-
// TBI: define swifttailcc void @"$s18isolation_macro_ir14callerFunctionyyYaF"(ptr swiftasync %0, i64 %1, i64 [[WORD_2:%.*]])
56-
// TBI: [[MASKED_WORD_2:%.*]] = and i64 [[WORD_2]], -3458764513820540929
57-
// TBI: musttail call swifttailcc void @"$s18isolation_macro_ir14calleeFunctionyyYaF"(ptr swiftasync {{%.*}}, i64 {{%.*}}, i64 [[MASKED_WORD_2]])
79+
// TBI: define internal swifttailcc void @"$s18isolation_macro_ir14callerFunctionyyYaFTY0_"(ptr swiftasync [[ASYNC_CONTEXT:%.*]])
80+
// TBI: [[ASYNC_FRAME_PTR:%.*]] = getelementptr inbounds i8, ptr [[ASYNC_CONTEXT]], i32 16
81+
// TBI: [[SECOND_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 2
82+
// TBI: [[SECOND_WORD:%.*]] = load i64, ptr [[SECOND_WORD_ADDR]]
83+
// TBI: [[MASKED_SECOND_WORD:%.*]] = and i64 [[SECOND_WORD]], -3458764513820540929
84+
// TBI: [[FIRST_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 1
85+
// TBI: [[FIRST_WORD:%.*]] = load i64, ptr [[FIRST_WORD_ADDR]]
86+
// TBI: musttail call swifttailcc void @"$s18isolation_macro_ir14calleeFunctionyyYaF"(ptr swiftasync {{%.*}}, i64 [[FIRST_WORD]], i64 [[MASKED_SECOND_WORD]])
5887

59-
// NO-TBI: define swifttailcc void @"$s18isolation_macro_ir14callerFunctionyyYaF"(ptr swiftasync %0, i64 %1, i64 [[WORD:%.*]])
60-
// NO-TBI: [[MASKED_WORD:%.*]] = and i64 [[WORD]], -4
61-
// NO-TBI: musttail call swifttailcc void @"$s18isolation_macro_ir14calleeFunctionyyYaF"(ptr swiftasync {{%.*}}, i64 {{%.*}}, i64 [[MASKED_WORD]])
88+
// NO-TBI: define internal swifttailcc void @"$s18isolation_macro_ir14callerFunctionyyYaFTY0_"(ptr swiftasync [[ASYNC_CONTEXT:%.*]])
89+
// NO-TBI: [[ASYNC_FRAME_PTR:%.*]] = getelementptr inbounds i8, ptr [[ASYNC_CONTEXT]], i32 16
90+
// NO-TBI: [[SECOND_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 2
91+
// NO-TBI: [[SECOND_WORD:%.*]] = load i64, ptr [[SECOND_WORD_ADDR]]
92+
// NO-TBI: [[MASKED_SECOND_WORD:%.*]] = and i64 [[SECOND_WORD]], -4
93+
// NO-TBI: [[FIRST_WORD_ADDR:%.*]] = getelementptr inbounds %"{{.*}}.Frame", ptr [[ASYNC_FRAME_PTR]], i32 0, i32 1
94+
// NO-TBI: [[FIRST_WORD:%.*]] = load i64, ptr [[FIRST_WORD_ADDR]]
95+
// NO-TBI: musttail call swifttailcc void @"$s18isolation_macro_ir14calleeFunctionyyYaF"(ptr swiftasync {{%.*}}, i64 [[FIRST_WORD]], i64 [[MASKED_SECOND_WORD]])
6296
@inline(never)
6397
public nonisolated(nonsending) func callerFunction() async {
6498
await calleeFunction()

0 commit comments

Comments
 (0)