|
1 |
| -// RUN: %target-swift-frontend %use_no_opaque_pointers -g -enable-objc-interop -primary-file %s -emit-ir -sil-verify-all -disable-llvm-optzns -disable-swift-specific-llvm-optzns | %IRGenFileCheck %s |
2 |
| -// RUN: %target-swift-frontend -g -enable-objc-interop -primary-file %s -emit-ir -sil-verify-all -disable-llvm-optzns -disable-swift-specific-llvm-optzns |
| 1 | +// RUN: %target-swift-frontend -g -enable-objc-interop -primary-file %s -emit-ir -sil-verify-all -disable-llvm-optzns -disable-swift-specific-llvm-optzns | %IRGenFileCheck %s |
3 | 2 | // RUN: %target-swift-frontend -enable-objc-interop -primary-file %s -emit-ir -sil-verify-all
|
4 | 3 |
|
5 | 4 | // REQUIRES: concurrency
|
|
15 | 14 | }
|
16 | 15 |
|
17 | 16 | // CHECK-LABEL: define{{.*}} @async_continuation(
|
18 |
| -// CHECK: [[ctxt_addr:%.*]] = alloca %swift.context* |
| 17 | +// CHECK: [[ctxt_addr:%.*]] = alloca ptr |
19 | 18 | // CHECK: [[cont_context:%.*]] = alloca %swift.continuation_context
|
20 | 19 | // CHECK: [[result_storage:%.*]] = alloca i32
|
21 | 20 | // CHECK: call token @llvm.coro.id.async
|
22 |
| -// CHECK: call i8* @llvm.coro.begin( |
| 21 | +// CHECK: call ptr @llvm.coro.begin( |
23 | 22 |
|
24 | 23 | // Initialize the async continuation context:
|
25 | 24 |
|
26 | 25 | // Initialize Parent.
|
27 |
| -// CHECK: [[base_context:%.*]] = getelementptr inbounds %swift.continuation_context, %swift.continuation_context* [[cont_context]], i32 0, i32 0 |
28 |
| -// CHECK: [[context_addr:%.*]] = getelementptr inbounds %swift.context, %swift.context* [[base_context]], i32 0, i32 0 |
29 |
| -// CHECK: [[ctxt:%.*]] = load %swift.context*, %swift.context** [[ctxt_addr]] |
30 |
| -// CHECK-arm64e: [[ctxt_addr_int:%[0-9]+]] = ptrtoint %swift.context** [[context_addr]] to i64 |
| 26 | +// CHECK: [[base_context:%.*]] = getelementptr inbounds %swift.continuation_context, ptr [[cont_context]], i32 0, i32 0 |
| 27 | +// CHECK: [[context_addr:%.*]] = getelementptr inbounds %swift.context, ptr [[base_context]], i32 0, i32 0 |
| 28 | +// CHECK: [[ctxt:%.*]] = load ptr, ptr [[ctxt_addr]] |
| 29 | +// CHECK-arm64e: [[ctxt_addr_int:%[0-9]+]] = ptrtoint ptr [[context_addr]] to i64 |
31 | 30 | // CHECK-arm64e: [[ptrauth_blend:%[0-9]+]] = call i64 @llvm.ptrauth.blend(i64 [[ctxt_addr_int]], i64 48546)
|
32 |
| -// CHECK-arm64e: [[ctxt_int:%[0-9]+]] = ptrtoint %swift.context* [[ctxt]] to i64 |
| 31 | +// CHECK-arm64e: [[ctxt_int:%[0-9]+]] = ptrtoint ptr [[ctxt]] to i64 |
33 | 32 | // CHECK-arm64e: [[signed_int:%[0-9]+]] = call i64 @llvm.ptrauth.sign(i64 [[ctxt_int]], i32 2, i64 [[ptrauth_blend]])
|
34 |
| -// CHECK-arm64e: [[signed_ctxt:%[0-9]+]] = inttoptr i64 [[signed_int]] to %swift.context* |
35 |
| -// CHECK-arm64e: store %swift.context* [[signed_ctxt]], %swift.context** [[context_addr]] |
36 |
| -// CHECK-x86_64: store %swift.context* [[ctxt]], %swift.context** [[context_addr]] |
| 33 | +// CHECK-arm64e: [[signed_ctxt:%[0-9]+]] = inttoptr i64 [[signed_int]] to ptr |
| 34 | +// CHECK-arm64e: store ptr [[signed_ctxt]], ptr [[context_addr]] |
| 35 | +// CHECK-x86_64: store ptr [[ctxt]], ptr [[context_addr]] |
37 | 36 |
|
38 | 37 | // Initialize NormalResult.
|
39 |
| -// CHECK: [[result_addr:%.*]] = getelementptr inbounds %swift.continuation_context, %swift.continuation_context* [[cont_context]], i32 0, i32 4 |
40 |
| -// CHECK: [[result_storage_as_opaque:%.*]] = bitcast i32* [[result_storage]] to %swift.opaque* |
41 |
| -// CHECK: store %swift.opaque* [[result_storage_as_opaque]], %swift.opaque** [[result_addr]] |
| 38 | +// CHECK: [[result_addr:%.*]] = getelementptr inbounds %swift.continuation_context, ptr [[cont_context]], i32 0, i32 4 |
| 39 | +// CHECK: store ptr [[result_storage]], ptr [[result_addr]] |
42 | 40 |
|
43 | 41 | // Initialize ResumeParent.
|
44 |
| -// CHECK: [[resume_intrinsic:%.*]] = call i8* @llvm.coro.async.resume() |
45 |
| -// CHECK: [[continuation_fn_addr:%.*]] = getelementptr inbounds %swift.context, %swift.context* [[base_context]], i32 0, i32 1 |
46 |
| -// CHECK: [[continuation_fn:%.*]] = bitcast i8* [[resume_intrinsic]] to void (%swift.context*)* |
47 |
| -// CHECK-arm64e: [[continuation_fn_addr_int:%[0-9]+]] = ptrtoint void (%swift.context*)** [[continuation_fn_addr]] to i64 |
| 42 | +// CHECK: [[resume_intrinsic:%.*]] = call ptr @llvm.coro.async.resume() |
| 43 | +// CHECK: [[continuation_fn_addr:%.*]] = getelementptr inbounds %swift.context, ptr [[base_context]], i32 0, i32 1 |
| 44 | +// CHECK-arm64e: [[continuation_fn_addr_int:%[0-9]+]] = ptrtoint ptr [[continuation_fn_addr]] to i64 |
48 | 45 | // CHECK-arm64e: [[ptrauth_blend:%[0-9]+]] = call i64 @llvm.ptrauth.blend(i64 [[continuation_fn_addr_int]], i64 55047)
|
49 |
| -// CHECK-arm64e: [[continuation_fn_int:%[0-9]+]] = ptrtoint void (%swift.context*)* [[continuation_fn]] to i64 |
| 46 | +// CHECK-arm64e: [[continuation_fn_int:%[0-9]+]] = ptrtoint ptr [[resume_intrinsic]] to i64 |
50 | 47 | // CHECK-arm64e: [[signed_int:%[0-9]+]] = call i64 @llvm.ptrauth.sign(i64 [[continuation_fn_int]], i32 0, i64 [[ptrauth_blend]])
|
51 |
| -// CHECK-arm64e: [[signed_continuation_fn:%[0-9]+]] = inttoptr i64 [[signed_int]] to void (%swift.context*)* |
52 |
| -// CHECK-arm64e: store void (%swift.context*)* [[signed_continuation_fn]], void (%swift.context*)** [[continuation_fn_addr]] |
53 |
| -// CHECK-x86_64: store void (%swift.context*)* [[continuation_fn]], void (%swift.context*)** [[continuation_fn_addr]] |
| 48 | +// CHECK-arm64e: [[signed_continuation_fn:%[0-9]+]] = inttoptr i64 [[signed_int]] to ptr |
| 49 | +// CHECK-arm64e: store ptr [[signed_continuation_fn]], ptr [[continuation_fn_addr]] |
| 50 | +// CHECK-x86_64: store ptr [[resume_intrinsic]], ptr [[continuation_fn_addr]] |
54 | 51 |
|
55 | 52 | // Call the runtime to retrieve and initialize the continuation.
|
56 |
| -// CHECK: call swiftcc %swift.task* @swift_continuation_init(%swift.continuation_context* [[cont_context]], [[INT]] 0) |
| 53 | +// CHECK: call swiftcc ptr @swift_continuation_init(ptr [[cont_context]], [[INT]] 0) |
57 | 54 |
|
58 | 55 | // Do some stuff.
|
59 | 56 | // CHECK: call swiftcc void @not_async_test()
|
60 | 57 |
|
61 | 58 | // Arrive at the await_async_continuation point.
|
62 |
| -// CHECK: [[suspend:%.*]] = call { i8* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8s(i32 0, i8* [[resume_intrinsic]], i8* bitcast (i8* (i8*)* @__swift_async_resume_project_context to i8*), i8* bitcast (void (%swift.continuation_context*)* @__swift_continuation_await_point to i8*), %swift.continuation_context* [[cont_context]]) |
63 |
| -// CHECK: [[result_addr_addr:%.*]] = getelementptr inbounds %swift.continuation_context, %swift.continuation_context* [[cont_context]], i32 0, i32 4 |
64 |
| -// CHECK: [[result_addr:%.*]] = load %swift.opaque*, %swift.opaque** [[result_addr_addr]] |
65 |
| -// CHECK: [[typed_result_addr:%.*]] = bitcast %swift.opaque* [[result_addr]] to i32* |
66 |
| -// CHECK: [[result_value:%.*]] = load i32, i32* [[typed_result_addr]] |
| 59 | +// CHECK: [[suspend:%.*]] = call { ptr } (i32, ptr, ptr, ...) @llvm.coro.suspend.async.sl_p0s(i32 0, ptr [[resume_intrinsic]], ptr @__swift_async_resume_project_context, ptr @__swift_continuation_await_point, ptr [[cont_context]]) |
| 60 | +// CHECK: [[result_addr_addr:%.*]] = getelementptr inbounds %swift.continuation_context, ptr [[cont_context]], i32 0, i32 4 |
| 61 | +// CHECK: [[result_addr:%.*]] = load ptr, ptr [[result_addr_addr]] |
| 62 | +// CHECK: [[result_value:%.*]] = load i32, ptr [[result_addr]] |
67 | 63 | // CHECK: br label %[[result_bb:[0-9]+]]
|
68 | 64 |
|
69 | 65 | // CHECK: [[result_bb]]:
|
70 | 66 | // CHECK: phi i32 [ [[result_value]], %entry ]
|
71 | 67 |
|
72 |
| -// CHECK: define {{.*}} void @__swift_continuation_await_point(%swift.continuation_context* %0) |
73 |
| -// CHECK: {{musttail call swifttailcc|tail call swiftcc}} void @swift_continuation_await(%swift.continuation_context* %0) |
| 68 | +// CHECK: define {{.*}} void @__swift_continuation_await_point(ptr %0) |
| 69 | +// CHECK: {{musttail call swifttailcc|tail call swiftcc}} void @swift_continuation_await(ptr %0) |
74 | 70 | // CHECK-NEXT: ret void
|
75 | 71 |
|
76 |
| -// CHECK: define {{.*}} void @async_continuation.0(i8* %0, %swift.context* %1){{.*}}!dbg ![[DBG:[0-9]+]] |
| 72 | +// CHECK: define {{.*}} void @async_continuation.0(ptr %0, ptr %1){{.*}}!dbg ![[DBG:[0-9]+]] |
77 | 73 | // CHECK-NOT: define
|
78 |
| -// CHECK: tail call swift{{(tail)?}}cc void %{{.*}}(%swift.context* swiftasync %1) |
| 74 | +// CHECK: tail call swift{{(tail)?}}cc void %{{.*}}(ptr swiftasync %1) |
79 | 75 | // CHECK-NEXT: ret void
|
80 | 76 | // CHECK: ![[DBG]] = distinct !DISubprogram(linkageName: "async_continuation"
|
81 | 77 |
|
|
0 commit comments