@@ -93,9 +93,7 @@ public distributed actor MyOtherActor {
93
93
// CHECK: store i8* %1, i8** %offset, align 8
94
94
// CHECK-NEXT: %elt_offset = load i8*, i8** %offset, align 8
95
95
// CHECK-NEXT: [[ELT_PTR:%.*]] = bitcast i8* %elt_offset to %TSi*
96
- // CHECK-NEXT: %argval = load %TSi, %TSi* [[ELT_PTR]], align 8
97
-
98
- // CHECK: [[NATIVE_VAL_LOC:%.*]] = bitcast %TSi* %argval.coercion.coerced to i64*
96
+ // CHECK-NEXT: [[NATIVE_VAL_LOC:%.*]] = getelementptr inbounds %TSi, %TSi* [[ELT_PTR]], i32 0, i32 0
99
97
// CHECK-NEXT: [[ARG_VAL:%.*]] = load i64, i64* [[NATIVE_VAL_LOC]], align 8
100
98
101
99
/// Retrieve an async pointer to the distributed thunk for `simple1`
@@ -156,11 +154,11 @@ public distributed actor MyOtherActor {
156
154
157
155
// CHECK: [[TYPED_RESULT_BUFF:%.*]] = bitcast i8* [[RESULT_BUFF]] to %TSi*
158
156
159
- // CHECK: %argval = load %TSS, %TSS* {{.*}}, align 8
160
- // CHECK: [[NATIVE_STR_PTR:%.*]] = bitcast %TSS* %argval.coercion.coerced to { i64, %swift.bridge* }*
161
- // CHECK-NEXT: [[NATIVE_STR:%.*]] = load { i64, %swift.bridge* }, { i64, %swift.bridge* }* [[NATIVE_STR_PTR]], align 8
162
- // CHECK: [[STR_SIZE:%.*]] = extractvalue { i64, %swift.bridge* } [[NATIVE_STR]], 0
163
- // CHECK-NEXT : [[STR_VAL:%.*]] = extractvalue { i64 , %swift.bridge* } [[NATIVE_STR]], 1
157
+ // CHECK: [[ELT_PTR:%.*]] = bitcast i8* %elt_offset to %TSS*
158
+ // CHECK-NEXT: %._guts = getelementptr inbounds %TSS, %TSS* [[ELT_PTR]], i32 0, i32 0
159
+
160
+ // CHECK: [[STR_SIZE:%.*]] = load i64, i64* %._guts._object._countAndFlagsBits._value
161
+ // CHECK: [[STR_VAL:%.*]] = load %swift.bridge* , %swift.bridge** %._guts._object._object, align 8
164
162
165
163
/// Load pointer to a distributed thunk for `simple3`
166
164
@@ -211,23 +209,18 @@ public distributed actor MyOtherActor {
211
209
// CHECK: [[TYPED_RESULT_BUFF:%.*]] = bitcast i8* %2 to %T27distributed_actor_accessors9IndirectEO*
212
210
// CHECK: store i8* %1, i8** %offset, align 8
213
211
// CHECK-NEXT: %elt_offset = load i8*, i8** %offset, align 8
212
+
214
213
// CHECK-NEXT: [[ENUM_PTR:%.*]] = bitcast i8* %elt_offset to %T27distributed_actor_accessors9IndirectEO*
215
- // CHECK-NEXT: %argval = load %T27distributed_actor_accessors9IndirectEO, %T27distributed_actor_accessors9IndirectEO* [[ENUM_PTR]], align 8
216
- // CHECK-NEXT: [[OPAQUE_ENUM_PTR:%.*]] = bitcast %T27distributed_actor_accessors9IndirectEO* %argval.coercion.coerced to i8*
217
- // CHECK: store %T27distributed_actor_accessors9IndirectEO %argval, %T27distributed_actor_accessors9IndirectEO* %argval.coercion.coerced, align 8
218
- // CHECK-NEXT: [[COERCED_ENUM_PTR:%.*]] = bitcast %T27distributed_actor_accessors9IndirectEO* %argval.coercion.coerced to i64*
219
- // CHECK-NEXT: [[NATIVE_ENUM_VAL:%.*]] = load i64, i64* [[COERCED_ENUM_PTR]], align 8
214
+ // CHECK-NEXT: [[NATIVE_ENUM_PTR:%.*]] = bitcast %T27distributed_actor_accessors9IndirectEO* [[ENUM_PTR]] to i64*
215
+ // CHECK-NEXT: [[NATIVE_ENUM_VAL:%.*]] = load i64, i64* [[NATIVE_ENUM_PTR]]
220
216
// CHECK: [[ENUM_PTR_INT:%.*]] = ptrtoint %T27distributed_actor_accessors9IndirectEO* [[ENUM_PTR]] to i64
221
217
// CHECK-NEXT: [[NEXT_ELT_LOC:%.*]] = add i64 [[ENUM_PTR_INT]], 8
222
218
// CHECK-NEXT: [[NEXT_ELT_PTR:%.*]] = inttoptr i64 [[NEXT_ELT_LOC]] to i8*
223
- // CHECK-NEXT: store i8* [[NEXT_ELT_PTR]], i8** %offset, align 8
224
- // CHECK-NEXT: %elt_offset1 = load i8*, i8** %offset, align 8
219
+ // CHECK-NEXT: store i8* [[NEXT_ELT_PTR]], i8** %offset
220
+ // CHECK-NEXT: %elt_offset1 = load i8*, i8** %offset
225
221
// CHECK-NEXT: [[INT_PTR:%.*]] = bitcast i8* %elt_offset1 to %TSi*
226
- // CHECK-NEXT: %argval2 = load %TSi, %TSi* [[INT_PTR]], align 8
227
- // CHECK-NEXT: [[OPAQUE_INT_PTR:%.*]] = bitcast %TSi* %argval2.coercion.coerced to i8*
228
- // CHECK: store %TSi %argval2, %TSi* %argval2.coercion.coerced, align 8
229
- // CHECK-NEXT: [[COERCED_INT_PTR:%.*]] = bitcast %TSi* %argval2.coercion.coerced to i64*
230
- // CHECK-NEXT: [[NATIVE_INT_VAL:%.*]] = load i64, i64* [[COERCED_INT_PTR]], align 8
222
+ // CHECK-NEXT: %._value = getelementptr inbounds %TSi, %TSi* [[INT_PTR]], i32 0, i32 0
223
+ // CHECK-NEXT: [[NATIVE_INT_VAL:%.*]] = load i64, i64* %._value
231
224
232
225
/// Call distributed thunk with extracted arguments.
233
226
@@ -255,10 +248,8 @@ public distributed actor MyOtherActor {
255
248
256
249
// CHECK: %elt_offset = load i8*, i8** %offset, align 8
257
250
// CHECK-NEXT: [[ARR_PTR:%.*]] = bitcast i8* %elt_offset to %TSa*
258
- // CHECK-NEXT: %argval = load %TSa, %TSa* [[ARR_PTR]], align 8
259
- // CHECK: store %TSa %argval, %TSa* %argval.coercion.coerced, align 8
260
- // CHECK-NEXT: [[PTR_TO_NATIVE_ARR:%.*]] = bitcast %TSa* %argval.coercion.coerced to [[NATIVE_ARR_TYPE:%.*]]
261
- // CHECK-NEXT: [[NATIVE_ARR_VAL:%.*]] = load {{.*}}, [[NATIVE_ARR_TYPE]] [[PTR_TO_NATIVE_ARR]], align 8
251
+ // CHECK-NEXT: %._buffer = getelementptr inbounds %TSa, %TSa* [[ARR_PTR]], i32 0, i32 0
252
+ // CHECK: [[NATIVE_ARR_VAL:%.*]] = load [[ARR_STORAGE_TYPE:%.*]], [[ARR_STORAGE_TYPE]]* %._buffer._storage
262
253
// CHECK: [[ARR_PTR_INT:%.*]] = ptrtoint %TSa* [[ARR_PTR]] to i64
263
254
// CHECK-NEXT: [[NEXT_ELT:%.*]] = add i64 [[ARR_PTR_INT]], 8
264
255
// CHECK-NEXT: [[OPAQUE_NEXT_ELT:%.*]] = inttoptr i64 [[NEXT_ELT]] to i8*
@@ -269,41 +260,37 @@ public distributed actor MyOtherActor {
269
260
// CHECK-NEXT: %elt_offset1 = load i8*, i8** %offset, align 8
270
261
// CHECK-NEXT: [[OBJ_PTR:%.*]] = bitcast i8* %elt_offset1 to %T27distributed_actor_accessors3ObjC**
271
262
// CHECK-NEXT: [[NATIVE_OBJ_VAL:%.*]] = load %T27distributed_actor_accessors3ObjC*, %T27distributed_actor_accessors3ObjC** [[OBJ_PTR]], align 8
272
- // CHECK-NEXT : [[OBJ_PTR_INT:%.*]] = ptrtoint %T27distributed_actor_accessors3ObjC** [[OBJ_PTR]] to i64
263
+ // CHECK: [[OBJ_PTR_INT:%.*]] = ptrtoint %T27distributed_actor_accessors3ObjC** [[OBJ_PTR]] to i64
273
264
// CHECK-NEXT: [[NEXT_ELT:%.*]] = add i64 [[OBJ_PTR_INT]], 8
274
265
// CHECK-NEXT: [[NEXT_ELT_PTR:%.*]] = inttoptr i64 [[NEXT_ELT]] to i8*
275
266
// CHECK-NEXT: store i8* [[NEXT_ELT_PTR]], i8** %offset, align 8
276
267
277
268
/// -> String?
278
269
279
- // CHECK-NEXT: %elt_offset3 = load i8*, i8** %offset, align 8
280
- // CHECK-NEXT: [[OPT_PTR:%.*]] = bitcast i8* %elt_offset3 to %TSSSg*
281
- // CHECK-NEXT: %argval4 = load %TSSSg, %TSSSg* [[OPT_PTR]], align 8
282
- // CHECK: store %TSSSg %argval4, %TSSSg* %argval4.coercion.coerced, align 8
283
- // CHECK-NEXT: [[NATIVE_OPT_PTR:%.*]] = bitcast %TSSSg* %argval4.coercion.coerced to { i64, i64 }*
284
- // CHECK-NEXT: [[NATIVE_OPT_VAL:%.*]] = load { i64, i64 }, { i64, i64 }* [[NATIVE_OPT_PTR]], align 8
285
- // CHECK: [[NATIVE_OPT_VAL_0:%.*]] = extractvalue { i64, i64 } [[NATIVE_OPT_VAL]], 0
286
- // CHECK-NEXT: [[NATIVE_OPT_VAL_1:%.*]] = extractvalue { i64, i64 } [[NATIVE_OPT_VAL]], 1
287
- // CHECK-NEXT: [[OPT_PTR_INT:%.*]] = ptrtoint %TSSSg* [[OPT_PTR]] to i64
270
+ // CHECK-NEXT: %elt_offset2 = load i8*, i8** %offset
271
+ // CHECK-NEXT: [[OPT_PTR:%.*]] = bitcast i8* %elt_offset2 to %TSSSg*
272
+ // CHECK-NEXT: [[NATIVE_OPT_PTR:%.*]] = bitcast %TSSSg* %22 to { i64, i64 }*
273
+ // CHECK-NEXT: [[NATIVE_OPT_VAL_0_PTR:%.*]] = getelementptr inbounds { i64, i64 }, { i64, i64 }* [[NATIVE_OPT_PTR]], i32 0, i32 0
274
+ // CHECK-NEXT: [[NATIVE_OPT_VAL_0:%.*]] = load i64, i64* [[NATIVE_OPT_VAL_0_PTR]]
275
+ // CHECK-NEXT: [[NATIVE_OPT_VAL_1_PTR:%.*]] = getelementptr inbounds { i64, i64 }, { i64, i64 }* [[NATIVE_OPT_PTR]], i32 0, i32 1
276
+ // CHECK-NEXT: [[NATIVE_OPT_VAL_1_OPAQUE:%.*]] = load i64, i64* [[NATIVE_OPT_VAL_1_PTR]]
277
+ // CHECK-NEXT: [[NATIVE_OPT_VAL_1_OBJ:%.*]] = inttoptr i64 [[NATIVE_OPT_VAL_1_OPAQUE]] to %swift.bridge*
278
+ // CHECK: [[NATIVE_OPT_VAL_1:%.*]] = ptrtoint %swift.bridge* [[NATIVE_OPT_VAL_1_OBJ]] to i64
279
+ // CHECK: [[OPT_PTR_INT:%.*]] = ptrtoint %TSSSg* [[OPT_PTR]] to i64
288
280
// CHECK-NEXT: [[NEXT_ELT:%.*]] = add i64 [[OPT_PTR_INT]], 16
289
281
// CHECK-NEXT: [[NEXT_ELT_PTR:%.*]] = inttoptr i64 [[NEXT_ELT]] to i8*
290
- // CHECK-NEXT: store i8* [[NEXT_ELT_PTR]], i8** %offset, align 8
282
+ // CHECK-NEXT: store i8* [[NEXT_ELT_PTR]], i8** %offset
291
283
292
284
/// -> LargeStruct (passed indirectly)
293
285
294
- // CHECK-NEXT: %elt_offset5 = load i8*, i8** %offset, align 8
295
- // CHECK-NEXT: [[STRUCT_PTR:%.*]] = bitcast i8* %elt_offset5 to %T27distributed_actor_accessors11LargeStructV*
296
- // CHECK-NEXT: [[STRUCT_VAL:%.*]] = load %T27distributed_actor_accessors11LargeStructV, %T27distributed_actor_accessors11LargeStructV* [[STRUCT_PTR]], align 8
286
+ // CHECK-NEXT: %elt_offset3 = load i8*, i8** %offset, align 8
287
+ // CHECK-NEXT: [[STRUCT_PTR:%.*]] = bitcast i8* %elt_offset3 to %T27distributed_actor_accessors11LargeStructV*
297
288
298
289
// CHECK: [[INDIRECT_RESULT_BUFF:%.*]] = bitcast %swift.opaque* [[TYPED_RESULT_BUFF]] to %T27distributed_actor_accessors11LargeStructV*
299
290
300
- // CHECK: store %T27distributed_actor_accessors11LargeStructV [[STRUCT_VAL]], %T27distributed_actor_accessors11LargeStructV* %argval6.coercion.coerced, align 8
301
- // CHECK-NEXT: [[PTR_TO_STRUCT:%.*]] = bitcast %T27distributed_actor_accessors11LargeStructV* %argval6.coercion.coerced to %T27distributed_actor_accessors11LargeStructV**
302
- // CHECK-NEXT: [[NATIVE_STRUCT_VAL:%.*]] = load %T27distributed_actor_accessors11LargeStructV*, %T27distributed_actor_accessors11LargeStructV** [[PTR_TO_STRUCT]], align 8
303
-
304
291
/// Now let's make sure that distributed thunk call uses the arguments correctly
305
292
306
- // CHECK: [[THUNK_RESULT:%.*]] = call { i8*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss({{.*}}, %T27distributed_actor_accessors11LargeStructV* [[INDIRECT_RESULT_BUFF]], %swift.context* {{.*}}, {{.*}} [[NATIVE_ARR_VAL]], %T27distributed_actor_accessors3ObjC* [[NATIVE_OBJ_VAL]], i64 [[NATIVE_OPT_VAL_0]], i64 [[NATIVE_OPT_VAL_1]], %T27distributed_actor_accessors11LargeStructV* [[NATIVE_STRUCT_VAL ]], %T27distributed_actor_accessors7MyActorC* {{.*}})
293
+ // CHECK: [[THUNK_RESULT:%.*]] = call { i8*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss({{.*}}, %T27distributed_actor_accessors11LargeStructV* [[INDIRECT_RESULT_BUFF]], %swift.context* {{.*}}, {{.*}} [[NATIVE_ARR_VAL]], %T27distributed_actor_accessors3ObjC* [[NATIVE_OBJ_VAL]], i64 [[NATIVE_OPT_VAL_0]], i64 [[NATIVE_OPT_VAL_1]], %T27distributed_actor_accessors11LargeStructV* [[STRUCT_PTR ]], %T27distributed_actor_accessors7MyActorC* {{.*}})
307
294
308
295
/// RESULT is returned indirectly so there is nothing to pass to `end`
309
296
0 commit comments