Skip to content

Commit 6c4b9c8

Browse files
committed
[Distributed] NFC: Adjust accessor IRGen test-cases to check for argument decoder instead of buffer
1 parent 46da680 commit 6c4b9c8

File tree

2 files changed

+132
-184
lines changed

2 files changed

+132
-184
lines changed

test/Distributed/distributed_actor_accessor_thunks_32bit.swift

Lines changed: 67 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,26 @@ public distributed actor MyOtherActor {
9494

9595
// CHECK: define hidden swifttailcc void @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTE"
9696

97-
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTETF"(%swift.context* swiftasync %0, i8* %1, i8* %2, i8* %3, {{.*}}, %T27distributed_actor_accessors7MyActorC* [[ACTOR:%.*]])
97+
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTETF"(%swift.context* swiftasync %0, %T27FakeDistributedActorSystems0A10InvocationC* %1, i8* %2, i8* %3, {{.*}}, %T27distributed_actor_accessors7MyActorC* [[ACTOR:%.*]])
9898

9999
/// Read the current offset and cast an element to `Int`
100100

101-
// CHECK: store i8* %1, i8** %offset
102-
// CHECK: %elt_offset = load i8*, i8** %offset
103-
// CHECK-NEXT: [[ELT_PTR:%.*]] = bitcast i8* %elt_offset to %TSi*
104-
// CHECK-NEXT: [[NATIVE_VAL_LOC:%.*]] = getelementptr inbounds %TSi, %TSi* [[ELT_PTR]], i32 0, i32 0
105-
// CHECK-NEXT: [[ARG_VAL:%.*]] = load i32, i32* [[NATIVE_VAL_LOC]]
101+
// CHECK: [[ARG_TYPES:%.*]] = bitcast i8* %2 to %swift.type**
102+
// CHECK-NEXT: [[DECODER:%.*]] = bitcast %T27FakeDistributedActorSystems0A10InvocationC* %1 to %swift.type**
103+
// CHECK-NEXT: [[DECODER_METADATA:%.*]] = load %swift.type*, %swift.type** [[DECODER]]
104+
// CHECK: [[ARG_0_TYPE_LOC:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[ARG_TYPES]], i32 0
105+
// CHECK-NEXT: %arg_type = load %swift.type*, %swift.type** [[ARG_0_TYPE_LOC]]
106+
// CHECK: %size = load i32, i32* {{.*}}
107+
// CHECK: [[ARG_0_SIZE_ADJ:%.*]] = add i32 %size, 15
108+
// CHECK-NEXT: [[ARG_0_SIZE:%.*]] = and i32 [[ARG_0_SIZE_ADJ]], -16
109+
// CHECK-NEXT: [[ARG_0_VALUE_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_0_SIZE]])
110+
// CHECK-NEXT: [[ARG_0_RES_SLOT:%.*]] = bitcast i8* [[ARG_0_VALUE_BUF]] to %swift.opaque*
111+
// CHECK-NEXT: call swiftcc void {{.*}}(%swift.opaque* noalias nocapture sret(%swift.opaque) [[ARG_0_RES_SLOT]], %swift.type* %arg_type, %T27FakeDistributedActorSystems0A10InvocationC* swiftself %1, %swift.error** noalias nocapture dereferenceable(4) %swifterror)
112+
113+
// CHECK: store %swift.error* null, %swift.error** %swifterror
114+
// CHECK-NEXT: [[ARG_0_VAL_ADDR:%.*]] = bitcast i8* [[ARG_0_VALUE_BUF]] to %TSi*
115+
// CHECK-NEXT: %._value = getelementptr inbounds %TSi, %TSi* [[ARG_0_VAL_ADDR]], i32 0, i32 0
116+
// CHECK-NEXT: [[ARG_VAL:%.*]] = load i32, i32* %._value
106117

107118
/// Setup task context for async call to `simple1` thunk
108119

@@ -131,7 +142,7 @@ public distributed actor MyOtherActor {
131142
// CHECK: [[COERCED_RESULT_SLOT:%.*]] = bitcast i8* {{.*}} to %TSS*
132143

133144
/// !!! - We are not going to double-check argument extraction here since it's the same as `simple1`.
134-
// CHECK: [[NATIVE_ARG_VAL:%.*]] = load i32, i32* {{.*}}
145+
// CHECK: [[NATIVE_ARG_VAL:%.*]] = load i32, i32* %._value
135146

136147
/// Setup task context for async call to `simple2` thunk
137148

@@ -164,12 +175,14 @@ public distributed actor MyOtherActor {
164175
// CHECK: define hidden swifttailcc void @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTE"
165176

166177
/// !!! in `simple3` interesting bits are: argument value extraction (because string is exploded into N arguments) and call to distributed thunk
167-
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTETF"(%swift.context* swiftasync {{.*}}, i8* [[ARG_BUFF:%.*]], i8* [[ARG_TYPES:%.*]], i8* [[RESULT_BUFF:%.*]], i8* [[SUBS:%.*]], i8* [[WITNESS_TABLES:%.*]], i32 [[NUM_WITNESS_TABLES:%.*]], %T27distributed_actor_accessors7MyActorC* [[ACTOR:%.*]])
178+
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTETF"(%swift.context* swiftasync {{.*}}, %T27FakeDistributedActorSystems0A10InvocationC* [[ARG_DECODER:%.*]], i8* [[ARG_TYPES:%.*]], i8* [[RESULT_BUFF:%.*]], i8* [[SUBS:%.*]], i8* [[WITNESS_TABLES:%.*]], i32 [[NUM_WITNESS_TABLES:%.*]], %T27distributed_actor_accessors7MyActorC* [[ACTOR:%.*]])
168179

169180
// CHECK: [[TYPED_RESULT_BUFF:%.*]] = bitcast i8* [[RESULT_BUFF]] to %TSi*
170181

171-
// CHECK: [[ELT_PTR:%.*]] = bitcast i8* %elt_offset to %TSS*
172-
// CHECK-NEXT: %._guts = getelementptr inbounds %TSS, %TSS* [[ELT_PTR]], i32 0, i32 0
182+
// CHECK: [[ARG_SIZE:%.*]] = and i32 {{.*}}, -16
183+
// CHECK: [[ARG_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_SIZE]])
184+
// CHECK: [[ARG_0_VALUE:%.*]] = bitcast i8* [[ARG_BUF]] to %TSS*
185+
// CHECK-NEXT: %._guts = getelementptr inbounds %TSS, %TSS* [[ARG_0_VALUE]], i32 0, i32 0
173186

174187
// CHECK: [[STR_SIZE:%.*]] = load i32, i32* %._guts._object._count._value
175188
// CHECK-NEXT: %._guts._object._variant = getelementptr inbounds %Ts13_StringObjectV, %Ts13_StringObjectV* %._guts._object, i32 0, i32 1
@@ -186,7 +199,7 @@ public distributed actor MyOtherActor {
186199

187200
// CHECK: store i32 {{.*}}, i32* %._guts1._object._count._value
188201
// CHECK: [[VARIANT:%.*]] = bitcast %Ts13_StringObjectV7VariantO* %._guts1._object._variant to i32*
189-
// CHECK-NEXT: store i32 %17, i32* [[VARIANT]]
202+
// CHECK-NEXT: store i32 {{.*}}, i32* [[VARIANT]]
190203

191204
// CHECK: [[STR_ARG_SIZE_PTR:%.*]] = getelementptr inbounds { i32, i32, i32 }, { i32, i32, i32 }* %temp-coercion.coerced, i32 0, i32 0
192205
// CHECK: [[STR_ARG_SIZE:%.*]] = load i32, i32* [[STR_ARG_SIZE_PTR]]
@@ -220,18 +233,9 @@ public distributed actor MyOtherActor {
220233

221234
// CHECK: define hidden swifttailcc void @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFFTE"
222235

223-
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFFTETF"(%swift.context* swiftasync %0, i8* [[BUFFER:%.*]], i8* [[ARG_TYPES:%.*]], i8* [[RESULT_BUFF:%.*]], i8* [[SUBS:%.*]], i8* [[WITNESS_TABLES:%.*]], i32 [[NUM_WITNESS_TABLES:%.*]], %T27distributed_actor_accessors7MyActorC* [[ACTOR:%.*]])
224-
225-
/// First, let's check that there were no loads from the argument buffer and no stores to "current offset".
236+
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFFTETF"(%swift.context* swiftasync %0, %T27FakeDistributedActorSystems0A10InvocationC* [[ARG_DECODER:%.*]], i8* [[ARG_TYPES:%.*]], i8* [[RESULT_BUFF:%.*]], i8* [[SUBS:%.*]], i8* [[WITNESS_TABLES:%.*]], i32 [[NUM_WITNESS_TABLES:%.*]], %T27distributed_actor_accessors7MyActorC* [[ACTOR:%.*]])
226237

227-
// CHECK: [[OFFSET:%.*]] = bitcast i8** %offset to i8*
228-
// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[OFFSET]])
229-
// CHECK-NEXT: store i8* [[BUFFER]], i8** %offset
230-
// CHECK: %elt_offset = load i8*, i8** %offset
231-
// CHECK-NEXT: [[OFFSET:%.*]] = bitcast i8** %offset to i8*
232-
// CHECK-NEXT call void @llvm.lifetime.end.p0i8(i32 8, i8* [[OFFSET]])
233-
234-
/// Now, let's check that the call doesn't have any arguments and returns nothing.
238+
/// Let's check that the call doesn't have any arguments and returns nothing.
235239

236240
// SKIP: [[THUNK_REF:%.*]] = bitcast void (%swift.context*, %T27distributed_actor_accessors7MyActorC*)* {{.*}} to i8*
237241
// SKIP: {{.*}} = call { i8*, %swift.error* } (i32, i8*, i8*, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.errorss({{.*}}, i8* [[THUNK_REF]], %swift.context* {{.*}}, %T27distributed_actor_accessors7MyActorC* {{.*}})
@@ -245,20 +249,19 @@ public distributed actor MyOtherActor {
245249
/// First, Load both arguments from the buffer.
246250

247251
// CHECK: [[TYPED_RESULT_BUFF:%.*]] = bitcast i8* [[RESULT_BUFF]] to %T27distributed_actor_accessors9IndirectEO*
248-
// CHECK: store i8* %1, i8** %offset
249-
// CHECK-NEXT: {{.*}} = bitcast i8* [[ARG_TYPES]] to %swift.type**
250-
// CHECK-NEXT: %elt_offset = load i8*, i8** %offset
251-
252-
// CHECK-NEXT: [[ENUM_PTR:%.*]] = bitcast i8* %elt_offset to %T27distributed_actor_accessors9IndirectEO*
253-
// CHECK-NEXT: [[NATIVE_ENUM_PTR:%.*]] = bitcast %T27distributed_actor_accessors9IndirectEO* [[ENUM_PTR]] to i32*
254-
// CHECK-NEXT: [[NATIVE_ENUM_VAL:%.*]] = load i32, i32* [[NATIVE_ENUM_PTR]]
255-
// CHECK: [[ENUM_PTR_INT:%.*]] = ptrtoint %T27distributed_actor_accessors9IndirectEO* [[ENUM_PTR]] to i32
256-
// CHECK-NEXT: [[NEXT_ELT_LOC:%.*]] = add i32 [[ENUM_PTR_INT]], 4
257-
// CHECK-NEXT: [[NEXT_ELT_PTR:%.*]] = inttoptr i32 [[NEXT_ELT_LOC]] to i8*
258-
// CHECK-NEXT: store i8* [[NEXT_ELT_PTR]], i8** %offset
259-
// CHECK-NEXT: %elt_offset1 = load i8*, i8** %offset
260-
// CHECK-NEXT: [[INT_PTR:%.*]] = bitcast i8* %elt_offset1 to %TSi*
261-
// CHECK-NEXT: %._value = getelementptr inbounds %TSi, %TSi* [[INT_PTR]], i32 0, i32 0
252+
253+
// CHECK: [[ARG_0_SIZE:%.*]] = and i32 {{.*}}, -16
254+
// CHECK-NEXT: [[ARG_0_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_0_SIZE]])
255+
256+
// CHECK: [[ARG_0_VAL_ADDR:%.*]] = bitcast i8* [[ARG_0_BUF]] to %T27distributed_actor_accessors9IndirectEO*
257+
// CHECK-NEXT: [[NATIVE_ENUM_VAL_ADDR:%.*]] = bitcast %T27distributed_actor_accessors9IndirectEO* [[ARG_0_VAL_ADDR]] to i32*
258+
// CHECK-NEXT: [[NATIVE_ENUM_VAL:%.*]] = load i32, i32* [[NATIVE_ENUM_VAL_ADDR]]
259+
260+
// CHECK: [[ARG_1_SIZE:%.*]] = and i32 {{.*}}, -16
261+
// CHECK-NEXT: [[ARG_1_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_1_SIZE]])
262+
263+
// CHECK: [[ARG_1_VAL_ADDR:%.*]] = bitcast i8* [[ARG_1_BUF]] to %TSi*
264+
// CHECK-NEXT: %._value = getelementptr inbounds %TSi, %TSi* [[ARG_1_VAL_ADDR]], i32 0, i32 0
262265
// CHECK-NEXT: [[NATIVE_INT_VAL:%.*]] = load i32, i32* %._value
263266

264267
/// Call distributed thunk with extracted arguments.
@@ -276,7 +279,7 @@ public distributed actor MyOtherActor {
276279

277280
// CHECK: define hidden swifttailcc void @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtFTE"
278281

279-
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtFTETF"(%swift.context* swiftasync {{.*}}, i8* [[ARG_BUFF:%.*]], i8* [[ARG_TYPES:%.*]], i8* [[RESULT_BUFF:%.*]], i8* [[SUBS:%.*]], i8* [[WITNESS_TABLES:%.*]], i32 [[NUM_WITNESS_TABLES:%.*]], %T27distributed_actor_accessors7MyActorC* [[ACTOR:%.*]])
282+
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtFTETF"(%swift.context* swiftasync {{.*}}, %T27FakeDistributedActorSystems0A10InvocationC* [[ARG_DECODER:%.*]], i8* [[ARG_TYPES:%.*]], i8* [[RESULT_BUFF:%.*]], i8* [[SUBS:%.*]], i8* [[WITNESS_TABLES:%.*]], i32 [[NUM_WITNESS_TABLES:%.*]], %T27distributed_actor_accessors7MyActorC* [[ACTOR:%.*]])
280283

281284
/// First, let's check that all of the different argument types here are loaded correctly.
282285

@@ -285,53 +288,45 @@ public distributed actor MyOtherActor {
285288

286289
/// -> [Int]
287290

288-
// CHECK: %elt_offset = load i8*, i8** %offset
289-
// CHECK-NEXT: [[ARR_PTR:%.*]] = bitcast i8* %elt_offset to %TSa*
290-
// CHECK-NEXT: %._buffer = getelementptr inbounds %TSa, %TSa* [[ARR_PTR]], i32 0, i32 0
291+
// CHECK: [[ARG_0_SIZE:%.*]] = and i32 {{.*}}, -16
292+
// CHECK-NEXT: [[ARG_0_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_0_SIZE]])
293+
294+
// CHECK: [[ARG_0_VAL_ADDR:%.*]] = bitcast i8* [[ARG_0_BUF]] to %TSa*
295+
// CHECK-NEXT: %._buffer = getelementptr inbounds %TSa, %TSa* [[ARG_0_VAL_ADDR]], i32 0, i32 0
291296
// CHECK: [[NATIVE_ARR_VAL:%.*]] = load [[ARR_STORAGE_TYPE:%.*]], [[ARR_STORAGE_TYPE]]* %._buffer._storage
292-
// CHECK: [[ARR_PTR_INT:%.*]] = ptrtoint %TSa* [[ARR_PTR]] to i32
293-
// CHECK-NEXT: [[NEXT_ELT:%.*]] = add i32 [[ARR_PTR_INT]], 4
294-
// CHECK-NEXT: [[OPAQUE_NEXT_ELT:%.*]] = inttoptr i32 [[NEXT_ELT]] to i8*
295-
// CHECK-NEXT: store i8* [[OPAQUE_NEXT_ELT]], i8** %offset
296297

297298
/// -> Obj
298299

299-
// CHECK-NEXT: %elt_offset1 = load i8*, i8** %offset
300-
// CHECK-NEXT: [[OBJ_PTR:%.*]] = bitcast i8* %elt_offset1 to %T27distributed_actor_accessors3ObjC**
300+
// CHECK: [[ARG_1_SIZE:%.*]] = and i32 {{.*}}, -16
301+
// CHECK-NEXT: [[ARG_1_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_1_SIZE]])
302+
303+
// CHECK: [[OBJ_PTR:%.*]] = bitcast i8* [[ARG_1_BUF]] to %T27distributed_actor_accessors3ObjC**
301304
// CHECK-NEXT: [[NATIVE_OBJ_VAL:%.*]] = load %T27distributed_actor_accessors3ObjC*, %T27distributed_actor_accessors3ObjC** [[OBJ_PTR]]
302-
// CHECK: [[OBJ_PTR_INT:%.*]] = ptrtoint %T27distributed_actor_accessors3ObjC** [[OBJ_PTR]] to i32
303-
// CHECK-NEXT: [[NEXT_ELT:%.*]] = add i32 [[OBJ_PTR_INT]], 4
304-
// CHECK-NEXT: [[NEXT_ELT_PTR:%.*]] = inttoptr i32 [[NEXT_ELT]] to i8*
305-
// CHECK-NEXT: store i8* [[NEXT_ELT_PTR]], i8** %offset
306305

307306
/// -> String?
308307

309-
// CHECK-NEXT: %elt_offset2 = load i8*, i8** %offset
310-
// CHECK-NEXT: [[OPT_PTR:%.*]] = bitcast i8* %elt_offset2 to %TSSSg*
308+
// CHECK: [[ARG_2_SIZE:%.*]] = and i32 {{.*}}, -16
309+
// CHECK-NEXT: [[ARG_2_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_2_SIZE]])
310+
311+
// CHECK: [[OPT_PTR:%.*]] = bitcast i8* [[ARG_2_BUF]] to %TSSSg*
311312
// CHECK-NEXT: [[NATIVE_OPT_PTR:%.*]] = bitcast %TSSSg* [[OPT_PTR]] to { i32, i32, i32 }*
312313
// CHECK-NEXT: [[NATIVE_OPT_VAL_0_PTR:%.*]] = getelementptr inbounds { i32, i32, i32 }, { i32, i32, i32 }* [[NATIVE_OPT_PTR]], i32 0, i32 0
313314
// CHECK-NEXT: [[NATIVE_OPT_VAL_0:%.*]] = load i32, i32* [[NATIVE_OPT_VAL_0_PTR]]
314315
// CHECK-NEXT: [[NATIVE_OPT_VAL_1_PTR:%.*]] = getelementptr inbounds { i32, i32, i32 }, { i32, i32, i32 }* [[NATIVE_OPT_PTR]], i32 0, i32 1
315316
// CHECK-NEXT: [[NATIVE_OPT_VAL_1:%.*]] = load i32, i32* [[NATIVE_OPT_VAL_1_PTR]]
316317
// CHECK-NEXT: [[NATIVE_OPT_VAL_2_PTR:%.*]] = getelementptr inbounds { i32, i32, i32 }, { i32, i32, i32 }* [[NATIVE_OPT_PTR]], i32 0, i32 2
317318
// CHECK-NEXT: [[NATIVE_OPT_VAL_2:%.*]] = load i32, i32* [[NATIVE_OPT_VAL_2_PTR]]
318-
// CHECK-NEXT: [[OPT_PTR_INT:%.*]] = ptrtoint %TSSSg* [[OPT_PTR]] to i32
319-
// CHECK-NEXT: [[NEXT_ELT:%.*]] = add i32 [[OPT_PTR_INT]], 12
320-
// CHECK-NEXT: [[NEXT_ELT_PTR:%.*]] = inttoptr i32 [[NEXT_ELT]] to i8*
321-
// CHECK-NEXT: store i8* [[NEXT_ELT_PTR]], i8** %offset
322319

323320
/// -> LargeStruct (passed indirectly)
324321

325-
// CHECK-NEXT: %elt_offset3 = load i8*, i8** %offset
326-
// CHECK-NEXT: [[STRUCT_PTR:%.*]] = bitcast i8* %elt_offset3 to %T27distributed_actor_accessors11LargeStructV*
327-
// CHECK-NEXT: [[STRUCT_PTR_VAL:%.*]] = ptrtoint %T27distributed_actor_accessors11LargeStructV* [[STRUCT_PTR]] to i32
328-
// CHECK-NEXT: [[STRUCT_PTR_VAL_ADJ_1:%.*]] = add nuw i32 [[STRUCT_PTR_VAL]], 7
329-
// CHECK-NEXT: [[STRUCT_PTR_VAL_ADJ_2:%.*]] = and i32 [[STRUCT_PTR_VAL_ADJ_1]], -8
330-
// CHECK-NEXT: [[STRUCT_PTR:%.*]] = inttoptr i32 [[STRUCT_PTR_VAL_ADJ_2]] to %T27distributed_actor_accessors11LargeStructV*
331-
322+
// CHECK: [[ARG_3_SIZE:%.*]] = and i32 {{.*}}, -16
323+
// CHECK-NEXT: [[ARG_3_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_3_SIZE]])
324+
// CHECK-NEXT: [[ARG_3_OPAQUE_PTR:%.*]] = bitcast i8* [[ARG_3_BUF]] to %swift.opaque*
332325

333326
// CHECK: [[INDIRECT_RESULT_BUFF:%.*]] = bitcast %swift.opaque* [[TYPED_RESULT_BUFF]] to %T27distributed_actor_accessors11LargeStructV*
334327

328+
// CHECK: [[STRUCT_PTR:%.*]] = bitcast %swift.opaque* [[ARG_3_OPAQUE_PTR]] to %T27distributed_actor_accessors11LargeStructV*
329+
335330
/// Now let's make sure that distributed thunk call uses the arguments correctly
336331

337332
// 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]], i32 [[NATIVE_OPT_VAL_0]], i32 [[NATIVE_OPT_VAL_1]], i32 [[NATIVE_OPT_VAL_2]], %T27distributed_actor_accessors11LargeStructV* [[STRUCT_PTR]], %T27distributed_actor_accessors7MyActorC* {{.*}})
@@ -343,43 +338,20 @@ public distributed actor MyOtherActor {
343338

344339
/// ---> Accessor for `genericArgs`
345340

346-
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors7MyActorC11genericArgsyyx_Sayq_GtSeRzSERzSeR_SER_r0_lFTETF"(%swift.context* swiftasync %0, i8* [[ARG_BUF:%.*]], i8* [[ARG_TYPES:%.*]], i8* [[RESULT_BUF:%.*]], i8* [[GENERIC_SUBS:%.*]], i8* [[WITNESS_TABLES:%.*]], i32 [[NUM_WITNESS_TABLES:%.*]], %T27distributed_actor_accessors7MyActorC* [[ACTOR:%.*]])
341+
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors7MyActorC11genericArgsyyx_Sayq_GtSeRzSERzSeR_SER_r0_lFTETF"(%swift.context* swiftasync %0, %T27FakeDistributedActorSystems0A10InvocationC* [[ARG_DECODER:%.*]], i8* [[ARG_TYPES:%.*]], i8* [[RESULT_BUF:%.*]], i8* [[GENERIC_SUBS:%.*]], i8* [[WITNESS_TABLES:%.*]], i32 [[NUM_WITNESS_TABLES:%.*]], %T27distributed_actor_accessors7MyActorC* [[ACTOR:%.*]])
347342

348343
/// ---> Load `T`
349344

350-
// CHECK: store i8* [[ARG_BUFF]], i8** %offset
351-
// CHECK-NEXT: [[ARG_TYPES_BUF:%.*]] = bitcast i8* [[ARG_TYPES]] to %swift.type**
352-
// CHECK-NEXT: %elt_offset = load i8*, i8** %offset
353-
// CHECK-NEXT: [[FIRST_ARG_TYPE_ADDR:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[ARG_TYPES_BUF]], i32 0
354-
// CHECK-NEXT: %arg_type = load %swift.type*, %swift.type** [[FIRST_ARG_TYPE_ADDR]]
355-
// CHECK: %size = load i32, i32* {{.*}}
356-
// CHECK: %flags = load i32, i32* {{.*}}
357-
// CHECK: [[ELT_PTR:%.*]] = ptrtoint i8* %elt_offset to i32
358-
// CHECK-NEXT: [[START_ELT_ALIGN:%.*]] = add nuw i32 [[ELT_PTR]], %flags.alignmentMask
359-
// CHECK-NEXT: [[ALIGNMENT:%.*]] = xor i32 %flags.alignmentMask, -1
360-
// CHECK-NEXT: [[ALIGNED_ELT_PTR:%.*]] = and i32 [[START_ELT_ALIGN]], [[ALIGNMENT]]
361-
// CHECK-NEXT: [[TYPED_ARG_0:%.*]] = inttoptr i32 [[ALIGNED_ELT_PTR:%.*]] to %swift.opaque*
362-
363-
/// Move offset to the next element
364-
365-
// CHECK: [[CUR_OFFSET:%.*]] = ptrtoint %swift.opaque* [[TYPED_ARG_0]] to i32
366-
// CHECK-NEXT: [[NEXT_OFFSET:%.*]] = add i32 [[CUR_OFFSET]], %size
367-
// CHECK-NEXT: [[NEXT_OFFSET_PTR:%.*]] = inttoptr i32 [[NEXT_OFFSET]] to i8*
368-
// CHECK-NEXT: store i8* [[NEXT_OFFSET_PTR]], i8** %offset
345+
// CHECK: [[ARG_0_SIZE:%.*]] = and i32 {{.*}}, -16
346+
// CHECK-NEXT: [[ARG_0_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_0_SIZE]])
347+
// CHECK: [[TYPED_ARG_0:%.*]] = bitcast i8* [[ARG_0_BUF]] to %swift.opaque*
369348

370349
/// ---> Load `[U]`
371350

372-
// CHECK: %elt_offset2 = load i8*, i8** %offset
373-
// CHECK-NEXT: [[SECOND_ARG_TYPE_ADDR:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[ARG_TYPES_BUF]], i32 1
374-
// CHECK-NEXT: %arg_type3 = load %swift.type*, %swift.type** [[SECOND_ARG_TYPE_ADDR]]
375-
// CHECK: %size4 = load i32, i32* {{.*}}
376-
// CHECK: %flags6 = load i32, i32* {{.*}}
377-
// CHECK: [[ELT_PTR:%.*]] = ptrtoint i8* %elt_offset2 to i32
378-
// CHECK-NEXT: [[START_ELT_ALIGN:%.*]] = add nuw i32 [[ELT_PTR]], %flags6.alignmentMask
379-
// CHECK-NEXT: [[ALIGNMENT:%.*]] = xor i32 %flags6.alignmentMask, -1
380-
// CHECK-NEXT: [[ALIGNED_ELT_PTR:%.*]] = and i32 [[START_ELT_ALIGN]], [[ALIGNMENT]]
381-
// CHECK-NEXT: [[TYPED_ARG_1:%.*]] = inttoptr i32 [[ALIGNED_ELT_PTR]] to %swift.opaque*
382-
// CHECK-NEXT: [[ARR_ARG_1:%.*]] = bitcast %swift.opaque* [[TYPED_ARG_1]] to %TSa*
351+
// CHECK: [[ARG_1_SIZE:%.*]] = and i32 {{.*}}, -16
352+
// CHECK-NEXT: [[ARG_1_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_1_SIZE]])
353+
354+
// CHECK: [[ARR_ARG_1:%.*]] = bitcast i8* [[ARG_1_BUF]] to %TSa*
383355
// CHECK-NEXT: %._buffer = getelementptr inbounds %TSa, %TSa* [[ARR_ARG_1]], i32 0, i32 0
384356
// CHECK-NEXT: %._buffer._storage = getelementptr inbounds %Ts12_ArrayBufferV, %Ts12_ArrayBufferV* %._buffer, i32 0, i32 0
385357
// CHECK-NEXT: %._buffer._storage.rawValue = getelementptr inbounds %Ts14_BridgeStorageV, %Ts14_BridgeStorageV* %._buffer._storage, i32 0, i32 0
@@ -417,7 +389,7 @@ public distributed actor MyOtherActor {
417389

418390
/// Let's check that there is no offset allocation here since parameter list is empty
419391

420-
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTETF"(%swift.context* swiftasync {{.*}}, i8* [[ARG_BUFF:%.*]], i8* [[ARG_TYPES:%.*]], i8* [[RESULT_BUFF:%.*]], i8* [[SUBS:%.*]], i8* [[WITNESS_TABLES:%.*]], i32 [[NUM_WITNESS_TABLES:%.*]], %T27distributed_actor_accessors12MyOtherActorC* {{.*}})
392+
// CHECK: define internal swifttailcc void @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTETF"(%swift.context* swiftasync {{.*}}, %T27FakeDistributedActorSystems0A10InvocationC* [[ARG_DECODER:%.*]], i8* [[ARG_TYPES:%.*]], i8* [[RESULT_BUFF:%.*]], i8* [[SUBS:%.*]], i8* [[WITNESS_TABLES:%.*]], i32 [[NUM_WITNESS_TABLES:%.*]], %T27distributed_actor_accessors12MyOtherActorC* {{.*}})
421393
// CHECK-NEXT: entry:
422394
// CHECK-NEXT: {{.*}} = alloca %swift.context*
423395
// CHECK-NEXT: %swifterror = alloca %swift.error*

0 commit comments

Comments
 (0)