Skip to content

Commit 375494b

Browse files
committed
[Distributed] IRGen: Fix method pointer retrieval
`getPointerToMethod()` should acoount for the fact that distributed thunk is an async function, so direct pointer should be to "async pointer" information instead of SIL function.
1 parent bcf2d5a commit 375494b

File tree

3 files changed

+76
-44
lines changed

3 files changed

+76
-44
lines changed

lib/IRGen/GenDistributed.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,12 @@ FunctionPointer DistributedAccessor::getPointerToMethod() const {
392392
auto signature = IGM.getSignature(fnType, fpKind.useSpecialConvention());
393393

394394
auto *fnPtr =
395-
IGM.getAddrOfSILFunction(Method, NotForDefinition,
396-
/*isDynamicallyReplaceable=*/false,
397-
/*shouldCallPreviousImplementation=*/false);
395+
llvm::ConstantExpr::getBitCast(IGM.getAddrOfAsyncFunctionPointer(Method),
396+
signature.getType()->getPointerTo());
398397

399-
return FunctionPointer::forDirect(fpKind, fnPtr, /*secondary=*/nullptr,
400-
signature);
398+
return FunctionPointer::forDirect(
399+
FunctionPointer::Kind(fnType), fnPtr,
400+
IGM.getAddrOfSILFunction(Method, NotForDefinition), signature);
401401
}
402402

403403
Callee

test/Distributed/distributed_actor_accessor_thunks_32bit.swift

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,20 @@ public distributed actor MyOtherActor {
100100
// CHECK-NEXT: [[NATIVE_VAL_LOC:%.*]] = getelementptr inbounds %TSi, %TSi* [[ELT_PTR]], i32 0, i32 0
101101
// CHECK-NEXT: [[ARG_VAL:%.*]] = load i32, i32* [[NATIVE_VAL_LOC]]
102102

103-
/// Retrieve an async pointer to the distributed thunk for `simple1`
103+
/// Setup task context for async call to `simple1` thunk
104104

105-
// CHECK: [[THUNK_LOC:%.*]] = add i32 ptrtoint (void (%swift.context*, i32, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTE" to i32), {{.*}}
106-
// CHECK-NEXT: [[OPAQUE_THUNK_PTR:%.*]] = inttoptr i32 [[THUNK_LOC]] to i8*
107-
// CHECK-NEXT: [[THUNK_PTR:%.*]] = bitcast i8* [[OPAQUE_THUNK_PTR]] to void (%swift.context*, i32, %T27distributed_actor_accessors7MyActorC*)*
105+
// CHECK: [[CONTEXT_SIZE:%.*]] = load i32, i32* getelementptr inbounds (%swift.async_func_pointer, %swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTETu", i32 0, i32 1)
106+
// CHECK-NEXT: [[THUNK_ASYNC_CONTEXT:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[CONTEXT_SIZE]])
107+
// CHECK: [[THUNK_CONTEXT_PTR:%.*]] = bitcast i8* [[THUNK_ASYNC_CONTEXT]] to %swift.context*
108108

109109
/// Call distributed thunk for `simple1` and `end` async context without results
110110

111-
// CHECK: [[THUNK_PTR_REF:%.*]] = bitcast void (%swift.context*, i32, %T27distributed_actor_accessors7MyActorC*)* [[THUNK_PTR]] to i8*
112-
// CHECK-NEXT: [[THUNK_RESULT:%.*]] = call { i8*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss({{.*}}, i8* [[THUNK_PTR_REF]], %swift.context* {{.*}}, i32 [[ARG_VAL]], %T27distributed_actor_accessors7MyActorC* {{.*}})
111+
// CHECK: [[THUNK_RESULT:%.*]] = call { i8*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss(
112+
// CHECK-SAME: i8* bitcast (void (%swift.context*, i32, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTE" to i8*)
113+
// CHECK-SAME: %swift.context* [[THUNK_CONTEXT_PTR]],
114+
// CHECK-SAME: i32 [[ARG_VAL]],
115+
// CHECK-SAME: %T27distributed_actor_accessors7MyActorC* %3)
116+
113117
// CHECK-NEXT: [[TASK_REF:%.*]] = extractvalue { i8*, %swift.error* } [[THUNK_RESULT]], 0
114118
// CHECK-NEXT: {{.*}} = call i8* @__swift_async_resume_project_context(i8* [[TASK_REF]])
115119
// CHECK: {{.*}} = call i1 (i8*, i1, ...) @llvm.coro.end.async({{.*}}, %swift.context* {{.*}}, %swift.error* {{.*}})
@@ -125,16 +129,20 @@ public distributed actor MyOtherActor {
125129
/// !!! - We are not going to double-check argument extraction here since it's the same as `simple1`.
126130
// CHECK: [[NATIVE_ARG_VAL:%.*]] = load i32, i32* {{.*}}
127131

128-
/// Load async pointer to distributed thunk for `simple2`
132+
/// Setup task context for async call to `simple2` thunk
129133

130-
// CHECK: [[THUNK_LOC:%.*]] = add i32 ptrtoint (void (%swift.context*, i32, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTE" to i32), {{.*}}
131-
// CHECK-NEXT: [[OPAQUE_THUNK_PTR:%.*]] = inttoptr i32 [[THUNK_LOC]] to i8*
132-
// CHECK-NEXT: [[THUNK_PTR:%.*]] = bitcast i8* [[OPAQUE_THUNK_PTR]] to void (%swift.context*, i32, %T27distributed_actor_accessors7MyActorC*)*
134+
// CHECK: [[CONTEXT_SIZE:%.*]] = load i32, i32* getelementptr inbounds (%swift.async_func_pointer, %swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTETu", i32 0, i32 1)
135+
// CHECK-NEXT: [[THUNK_ASYNC_CONTEXT:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[CONTEXT_SIZE]])
136+
// CHECK: [[THUNK_CONTEXT_PTR:%.*]] = bitcast i8* [[THUNK_ASYNC_CONTEXT]] to %swift.context*
133137

134138
/// Call the thunk with extracted argument value
135139

136-
// CHECK: [[THUNK_PTR_REF:%.*]] = bitcast void (%swift.context*, i32, %T27distributed_actor_accessors7MyActorC*)* [[THUNK_PTR]] to i8*
137-
// CHECK-NEXT: [[THUNK_RESULT:%.*]] = call { i8*, i32, i32, i32, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8i32i32i32p0s_swift.errorss({{.*}}, i8* [[THUNK_PTR_REF]], %swift.context* {{.*}}, i32 [[NATIVE_ARG_VAL]], %T27distributed_actor_accessors7MyActorC* {{.*}})
140+
// CHECK: [[THUNK_RESULT:%.*]] = call { i8*, i32, i32, i32, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8i32i32i32p0s_swift.errorss(
141+
// CHECK-SAME: i8* bitcast (void (%swift.context*, i32, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTE" to i8*)
142+
// CHECK-SAME: %swift.context* [[THUNK_CONTEXT_PTR]],
143+
// CHECK-SAME: i32 [[NATIVE_ARG_VAL]],
144+
// CHECK-SAME: %T27distributed_actor_accessors7MyActorC* %3)
145+
138146
// CHECK-NEXT: [[TASK_REF:%.*]] = extractvalue { i8*, i32, i32, i32, %swift.error* } [[THUNK_RESULT]], 0
139147
// CHECK-NEXT: {{.*}} = call i8* @__swift_async_resume_project_context(i8* [[TASK_REF]])
140148

@@ -164,17 +172,17 @@ public distributed actor MyOtherActor {
164172
// CHECK-NEXT: [[NATIVE_STR_VAL_PTR:%.*]] = bitcast %Ts13_StringObjectV7VariantO* %._guts._object._variant to i32*
165173
// CHECK-NEXT: [[STR_VAL:%.*]] = load i32, i32* [[NATIVE_STR_VAL_PTR]]
166174

167-
/// Load pointer to a distributed thunk for `simple3`
175+
/// Setup task context for async call to `simple3` thunk
168176

169-
// CHECK: [[THUNK_LOC:%.*]] = add i32 ptrtoint (void (%swift.context*, i32, i32, i32, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTE" to i32)
170-
// CHECK-NEXT: [[OPAQUE_THUNK_PTR:%.*]] = inttoptr i32 [[THUNK_LOC]] to i8*
171-
// CHECK-NEXT: [[THUNK_PTR:%.*]] = bitcast i8* [[OPAQUE_THUNK_PTR]] to void (%swift.context*, i32, i32, i32, %T27distributed_actor_accessors7MyActorC*)*
177+
// CHECK: [[CONTEXT_SIZE:%.*]] = load i32, i32* getelementptr inbounds (%swift.async_func_pointer, %swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTETu", i32 0, i32 1)
178+
// CHECK-NEXT: [[THUNK_ASYNC_CONTEXT:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[CONTEXT_SIZE]])
172179

173180
// CHECK: [[TMP_STR_ARG:%.*]] = bitcast { i32, i32, i32 }* %temp-coercion.coerced to %TSS*
174181
// CHECK-NEXT: %._guts1 = getelementptr inbounds %TSS, %TSS* [[TMP_STR_ARG]], i32 0, i32 0
175182

176183
// CHECK: store i32 %10, i32* %._guts1._object._count._value, align 4
177-
// CHECK: store i32 %12, i32* %28, align 4
184+
// CHECK: [[VARIANT:%.*]] = bitcast %Ts13_StringObjectV7VariantO* %._guts1._object._variant to i32*
185+
// CHECK-NEXT: store i32 %12, i32* [[VARIANT]], align 4
178186

179187
// CHECK: [[STR_ARG_SIZE_PTR:%.*]] = getelementptr inbounds { i32, i32, i32 }, { i32, i32, i32 }* %temp-coercion.coerced, i32 0, i32 0
180188
// CHECK: [[STR_ARG_SIZE:%.*]] = load i32, i32* [[STR_ARG_SIZE_PTR]]
@@ -187,8 +195,16 @@ public distributed actor MyOtherActor {
187195

188196
/// Call distributed thunk with exploaded string value
189197

190-
// CHECK: [[OPAQUE_THUNK_PTR:%.*]] = bitcast void (%swift.context*, i32, i32, i32, %T27distributed_actor_accessors7MyActorC*)* [[THUNK_PTR]] to i8*
191-
// CHECK-NEXT: [[THUNK_RESULT:%.*]] = call { i8*, i32, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8i32p0s_swift.errorss({{.*}}, i8* [[OPAQUE_THUNK_PTR]], %swift.context* {{.*}}, i32 [[STR_ARG_SIZE]], i32 [[STR_ARG_VAL]], i32 [[STR_ARG_FLAGS]], %T27distributed_actor_accessors7MyActorC* {{.*}})
198+
// CHECK: [[THUNK_CONTEXT_PTR:%.*]] = bitcast i8* [[THUNK_ASYNC_CONTEXT]] to %swift.context*
199+
200+
// CHECK: [[THUNK_RESULT:%.*]] = call { i8*, i32, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8i32p0s_swift.errorss(
201+
// CHECK-SAME: i8* bitcast (void (%swift.context*, i32, i32, i32, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTE" to i8*),
202+
// CHECK-SAME: %swift.context* [[THUNK_CONTEXT_PTR]],
203+
// CHECK-SAME: i32 [[STR_ARG_SIZE]],
204+
// CHECK-SAME: i32 [[STR_ARG_VAL]],
205+
// CHECK_SAME: i32 [[STR_ARG_FLAGS]],
206+
// CHECK-SAME: %T27distributed_actor_accessors7MyActorC* %3)
207+
192208
// CHECK-NEXT: [[TASK_REF:%.*]] = extractvalue { i8*, i32, %swift.error* } [[THUNK_RESULT]], 0
193209
// CHECK-NEXT: {{.*}} = call i8* @__swift_async_resume_project_context(i8* [[TASK_REF]])
194210
// CHECK: [[INT_RES:%.*]] = extractvalue { i8*, i32, %swift.error* } [[THUNK_RESULT]], 1
@@ -333,4 +349,4 @@ public distributed actor MyOtherActor {
333349
// CHECK-NEXT: store %swift.context* {{.*}}, %swift.context** {{.*}}
334350
// CHECK-NEXT: store %swift.error* null, %swift.error** %swifterror
335351
// CHECK-NEXT: {{.*}} = bitcast i8* [[RESULT_BUFF]] to %swift.opaque*
336-
// CHECK-NEXT: {{.*}} = load i32, i32* getelementptr inbounds (%swift.async_func_pointer, %swift.async_func_pointer* bitcast (void (%swift.context*, %T27distributed_actor_accessors12MyOtherActorC*)* @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTE" to %swift.async_func_pointer*), i32 0, i32 0)
352+
// CHECK-NEXT: {{.*}} = load i32, i32* getelementptr inbounds (%swift.async_func_pointer, %swift.async_func_pointer* @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTETu", i32 0, i32 1)

test/Distributed/distributed_actor_accessor_thunks_64bit.swift

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,21 @@ public distributed actor MyOtherActor {
100100
// CHECK-NEXT: [[NATIVE_VAL_LOC:%.*]] = getelementptr inbounds %TSi, %TSi* [[ELT_PTR]], i32 0, i32 0
101101
// CHECK-NEXT: [[ARG_VAL:%.*]] = load i64, i64* [[NATIVE_VAL_LOC]]
102102

103-
/// Retrieve an async pointer to the distributed thunk for `simple1`
103+
/// Setup task context for async call to `simple1` thunk
104104

105-
// CHECK: [[THUNK_LOC:%.*]] = add i64 ptrtoint (void (%swift.context*, i64, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTE" to i64), {{.*}}
106-
// CHECK-NEXT: [[OPAQUE_THUNK_PTR:%.*]] = inttoptr i64 [[THUNK_LOC]] to i8*
107-
// CHECK-NEXT: [[THUNK_PTR:%.*]] = bitcast i8* [[OPAQUE_THUNK_PTR]] to void (%swift.context*, i64, %T27distributed_actor_accessors7MyActorC*)*
105+
// CHECK: [[CONTEXT_SIZE:%.*]] = load i32, i32* getelementptr inbounds (%swift.async_func_pointer, %swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTETu", i32 0, i32 1)
106+
// CHECK-NEXT: [[CONTEXT_SIZE_64:%.*]] = zext i32 [[CONTEXT_SIZE]] to i64
107+
// CHECK-NEXT: [[THUNK_ASYNC_CONTEXT:%.*]] = call swiftcc i8* @swift_task_alloc(i64 [[CONTEXT_SIZE_64]])
108+
// CHECK: [[THUNK_CONTEXT_PTR:%.*]] = bitcast i8* [[THUNK_ASYNC_CONTEXT]] to %swift.context*
108109

109110
/// Call distributed thunk for `simple1` and `end` async context without results
110111

111-
// CHECK: [[THUNK_PTR_REF:%.*]] = bitcast void (%swift.context*, i64, %T27distributed_actor_accessors7MyActorC*)* [[THUNK_PTR]] to i8*
112-
// CHECK-NEXT: [[THUNK_RESULT:%.*]] = call { i8*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss({{.*}}, i8* [[THUNK_PTR_REF]], %swift.context* {{.*}}, i64 [[ARG_VAL]], %T27distributed_actor_accessors7MyActorC* {{.*}})
112+
// CHECK: [[THUNK_RESULT:%.*]] = call { i8*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss(
113+
// CHECK-SAME: i8* bitcast (void (%swift.context*, i64, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTE" to i8*),
114+
// CHECK-SAME: %swift.context* [[THUNK_CONTEXT_PTR]],
115+
// CHECK-SAME: i64 [[ARG_VAL]],
116+
// CHECK-SAME: %T27distributed_actor_accessors7MyActorC* %3)
117+
113118
// CHECK-NEXT: [[TASK_REF:%.*]] = extractvalue { i8*, %swift.error* } [[THUNK_RESULT]], 0
114119
// CHECK-NEXT: {{.*}} = call i8* @__swift_async_resume_project_context(i8* [[TASK_REF]])
115120
// CHECK: {{.*}} = call i1 (i8*, i1, ...) @llvm.coro.end.async({{.*}}, %swift.context* {{.*}}, %swift.error* {{.*}})
@@ -123,16 +128,21 @@ public distributed actor MyOtherActor {
123128
/// !!! - We are not going to double-check argument extraction here since it's the same as `simple1`.
124129
// CHECK: [[NATIVE_ARG_VAL:%.*]] = load i64, i64* {{.*}}
125130

126-
/// Load async pointer to distributed thunk for `simple2`
131+
/// Setup task context for async call to `simple2` thunk
127132

128-
// CHECK: [[THUNK_LOC:%.*]] = add i64 ptrtoint (void (%swift.context*, i64, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTE" to i64), {{.*}}
129-
// CHECK-NEXT: [[OPAQUE_THUNK_PTR:%.*]] = inttoptr i64 [[THUNK_LOC]] to i8*
130-
// CHECK-NEXT: [[THUNK_PTR:%.*]] = bitcast i8* [[OPAQUE_THUNK_PTR]] to void (%swift.context*, i64, %T27distributed_actor_accessors7MyActorC*)*
133+
// CHECK: [[CONTEXT_SIZE:%.*]] = load i32, i32* getelementptr inbounds (%swift.async_func_pointer, %swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTETu", i32 0, i32 1)
134+
// CHECK-NEXT: [[CONTEXT_SIZE_64:%.*]] = zext i32 [[CONTEXT_SIZE]] to i64
135+
// CHECK-NEXT: [[THUNK_ASYNC_CONTEXT:%.*]] = call swiftcc i8* @swift_task_alloc(i64 [[CONTEXT_SIZE_64]])
136+
// CHECK: [[THUNK_CONTEXT_PTR:%.*]] = bitcast i8* [[THUNK_ASYNC_CONTEXT]] to %swift.context*
131137

132138
/// Call the thunk with extracted argument value
133139

134-
// CHECK: [[THUNK_PTR_REF:%.*]] = bitcast void (%swift.context*, i64, %T27distributed_actor_accessors7MyActorC*)* [[THUNK_PTR]] to i8*
135-
// CHECK-NEXT: [[THUNK_RESULT:%.*]] = call { i8*, i64, %swift.bridge*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8i64p0s_swift.bridgesp0s_swift.errorss({{.*}}, i8* [[THUNK_PTR_REF]], %swift.context* {{.*}}, i64 [[NATIVE_ARG_VAL]], %T27distributed_actor_accessors7MyActorC* {{.*}})
140+
// CHECK: [[THUNK_RESULT:%.*]] = call { i8*, i64, %swift.bridge*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8i64p0s_swift.bridgesp0s_swift.errorss(
141+
// CHECK-SAME: i8* bitcast (void (%swift.context*, i64, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTE" to i8*),
142+
// CHECK-SAME: %swift.context* [[THUNK_CONTEXT_PTR]],
143+
// CHECK-SAME: i64 [[NATIVE_ARG_VAL]],
144+
// CHECK-SAME: %T27distributed_actor_accessors7MyActorC* %3)
145+
136146
// CHECK-NEXT: [[TASK_REF:%.*]] = extractvalue { i8*, i64, %swift.bridge*, %swift.error* } [[THUNK_RESULT]], 0
137147
// CHECK-NEXT: {{.*}} = call i8* @__swift_async_resume_project_context(i8* [[TASK_REF]])
138148

@@ -164,16 +174,22 @@ public distributed actor MyOtherActor {
164174
// CHECK: [[STR_SIZE:%.*]] = load i64, i64* %._guts._object._countAndFlagsBits._value
165175
// CHECK: [[STR_VAL:%.*]] = load %swift.bridge*, %swift.bridge** %._guts._object._object
166176

167-
/// Load pointer to a distributed thunk for `simple3`
177+
/// Setup task context for async call to `simple3` thunk
168178

169-
// CHECK: [[THUNK_LOC:%.*]] = add i64 ptrtoint (void (%swift.context*, i64, %swift.bridge*, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTE" to i64), {{.*}}
170-
// CHECK-NEXT: [[OPAQUE_THUNK_PTR:%.*]] = inttoptr i64 [[THUNK_LOC]] to i8*
171-
// CHECK-NEXT: [[THUNK_PTR:%.*]] = bitcast i8* [[OPAQUE_THUNK_PTR]] to void (%swift.context*, i64, %swift.bridge*, %T27distributed_actor_accessors7MyActorC*)*
179+
// CHECK: [[CONTEXT_SIZE:%.*]] = load i32, i32* getelementptr inbounds (%swift.async_func_pointer, %swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTETu", i32 0, i32 1)
180+
// CHECK-NEXT: [[CONTEXT_SIZE_64:%.*]] = zext i32 [[CONTEXT_SIZE]] to i64
181+
// CHECK-NEXT: [[THUNK_ASYNC_CONTEXT:%.*]] = call swiftcc i8* @swift_task_alloc(i64 [[CONTEXT_SIZE_64]])
182+
// CHECK: [[THUNK_CONTEXT_PTR:%.*]] = bitcast i8* [[THUNK_ASYNC_CONTEXT]] to %swift.context*
172183

173184
/// Call distributed thunk with exploaded string value
174185

175-
// CHECK: [[OPAQUE_THUNK_PTR:%.*]] = bitcast void (%swift.context*, i64, %swift.bridge*, %T27distributed_actor_accessors7MyActorC*)* [[THUNK_PTR]] to i8*
176-
// CHECK-NEXT: [[THUNK_RESULT:%.*]] = call { i8*, i64, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8i64p0s_swift.errorss({{.*}}, i8* [[OPAQUE_THUNK_PTR]], %swift.context* {{.*}}, i64 [[STR_SIZE]], %swift.bridge* [[STR_VAL]], %T27distributed_actor_accessors7MyActorC* {{.*}})
186+
// CHECK: [[THUNK_RESULT:%.*]] = call { i8*, i64, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8i64p0s_swift.errorss(
187+
// CHECK-SAME: i8* bitcast (void (%swift.context*, i64, %swift.bridge*, %T27distributed_actor_accessors7MyActorC*)* @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTE" to i8*),
188+
// CHECK-SAME: %swift.context* [[THUNK_CONTEXT_PTR]],
189+
// CHECK-SAME: i64 [[STR_SIZE]],
190+
// CHECK-SAME: %swift.bridge* [[STR_VAL]],
191+
// CHECK-SAME: %T27distributed_actor_accessors7MyActorC* %3)
192+
177193
// CHECK-NEXT: [[TASK_REF:%.*]] = extractvalue { i8*, i64, %swift.error* } [[THUNK_RESULT]], 0
178194
// CHECK-NEXT: {{.*}} = call i8* @__swift_async_resume_project_context(i8* [[TASK_REF]])
179195
// CHECK: [[INT_RES:%.*]] = extractvalue { i8*, i64, %swift.error* } [[THUNK_RESULT]], 1
@@ -311,4 +327,4 @@ public distributed actor MyOtherActor {
311327
// CHECK-NEXT: store %swift.context* {{.*}}, %swift.context** {{.*}}
312328
// CHECK-NEXT: store %swift.error* null, %swift.error** %swifterror
313329
// CHECK-NEXT: {{.*}} = bitcast i8* [[RESULT_BUFF]] to %swift.opaque*
314-
// CHECK-NEXT: {{.*}} = load i32, i32* getelementptr inbounds (%swift.async_func_pointer, %swift.async_func_pointer* bitcast (void (%swift.context*, %T27distributed_actor_accessors12MyOtherActorC*)* @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTE" to %swift.async_func_pointer*), i32 0, i32 0)
330+
// CHECK-NEXT: {{.*}} = load i32, i32* getelementptr inbounds (%swift.async_func_pointer, %swift.async_func_pointer* @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTETu", i32 0, i32 1)

0 commit comments

Comments
 (0)