Skip to content

Commit 560e96f

Browse files
ktosoxedin
authored andcommitted
[Distributed] Temporarily simplify SIL tests; avoid a few checks
1 parent 4e2c059 commit 560e96f

File tree

3 files changed

+11
-24
lines changed

3 files changed

+11
-24
lines changed

lib/SIL/IR/SILFunctionBuilder.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,14 @@ void SILFunctionBuilder::addFunctionAttributes(
221221
F->setDynamicallyReplacedFunction(replacedFunc);
222222
}
223223
} else if (constant.isDistributedThunk()) {
224-
if (auto decodeFuncDecl =
224+
auto decodeFuncDecl =
225225
getAssociatedDistributedInvocationDecoderDecodeNextArgumentFunction(
226-
decl)) {
226+
decl);
227+
assert(decodeFuncDecl && "decodeNextArgument function not found!");
227228

228-
auto decodeRef = SILDeclRef(decodeFuncDecl);
229-
auto *adHocFunc = getOrCreateDeclaration(decodeFuncDecl, decodeRef);
230-
F->setReferencedAdHocRequirementWitnessFunction(adHocFunc);
231-
}
229+
auto decodeRef = SILDeclRef(decodeFuncDecl);
230+
auto *adHocFunc = getOrCreateDeclaration(decodeFuncDecl, decodeRef);
231+
F->setReferencedAdHocRequirementWitnessFunction(adHocFunc);
232232
}
233233
}
234234

test/Distributed/distributed_actor_accessor_thunks_32bit.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,9 @@ public distributed actor MyOtherActor {
100100

101101
// CHECK: [[DECODER_PTR:%*]] = bitcast %swift.opaque* %1 to %T27FakeDistributedActorSystems0A17InvocationDecoderC**
102102
// CHECK-NEXT: [[DECODER:%.*]] = load %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %T27FakeDistributedActorSystems0A17InvocationDecoderC** [[DECODER_PTR]]
103-
// CHECK-NEXT: [[DECODER_METADATA:%.*]] = bitcast %swift.type* [[DECODER_TYPE]] to void (%swift.opaque*, %swift.type*, i8**, i8**, %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %swift.error**)**
104-
// CHECK-NEXT: [[DECODE_NEXT_ARG_REF:%.*]] = getelementptr inbounds void (%swift.opaque*, %swift.type*, i8**, i8**, %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %swift.error**)*, void (%swift.opaque*, %swift.type*, i8**, i8**, %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %swift.error**)** [[DECODER_METADATA]], i32 35
105-
// CHECK-NEXT: [[DECODE_NEXT_ARG:%.*]] = load void (%swift.opaque*, %swift.type*, i8**, i8**, %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %swift.error**)*, void (%swift.opaque*, %swift.type*, i8**, i8**, %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %swift.error**)** [[DECODE_NEXT_ARG_REF]]
103+
// CHECK-NEXT: [[DECODER_METADATA:%.*]] = bitcast i8* %2 to %swift.type*
104+
// CHECK-NEXT: [[DECODE_NEXT_ARG_REF:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[DECODER_METADATA]], i32
106105

107-
108-
// CHECK: [[ARG_TYPES:%.*]] = bitcast i8* %2 to %swift.type**
109-
110-
// CHECK: [[ARG_0_TYPE_LOC:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[ARG_TYPES]], i32 0
111-
// CHECK-NEXT: %arg_type = load %swift.type*, %swift.type** [[ARG_0_TYPE_LOC]]
112-
// CHECK: %size = load i32, i32* {{.*}}
113106
// CHECK: [[ARG_0_SIZE_ADJ:%.*]] = add i32 %size, 15
114107
// CHECK-NEXT: [[ARG_0_SIZE:%.*]] = and i32 [[ARG_0_SIZE_ADJ]], -16
115108
// CHECK-NEXT: [[ARG_0_VALUE_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i32 [[ARG_0_SIZE]])

test/Distributed/distributed_actor_accessor_thunks_64bit.swift

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,9 @@ public distributed actor MyOtherActor {
100100

101101
// CHECK: [[DECODER_PTR:%*]] = bitcast %swift.opaque* %1 to %T27FakeDistributedActorSystems0A17InvocationDecoderC**
102102
// CHECK-NEXT: [[DECODER:%.*]] = load %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %T27FakeDistributedActorSystems0A17InvocationDecoderC** [[DECODER_PTR]]
103-
// CHECK-NEXT: [[DECODER_METADATA:%.*]] = bitcast %swift.type* [[DECODER_TYPE]] to void (%swift.opaque*, %swift.type*, i8**, i8**, %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %swift.error**)**
104-
// CHECK-NEXT: [[DECODE_NEXT_ARG_REF:%.*]] = getelementptr inbounds void (%swift.opaque*, %swift.type*, i8**, i8**, %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %swift.error**)*, void (%swift.opaque*, %swift.type*, i8**, i8**, %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %swift.error**)** [[DECODER_METADATA]], i64 {{29|32}}
105-
// CHECK-NEXT: [[DECODE_NEXT_ARG:%.*]] = load void (%swift.opaque*, %swift.type*, i8**, i8**, %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %swift.error**)*, void (%swift.opaque*, %swift.type*, i8**, i8**, %T27FakeDistributedActorSystems0A17InvocationDecoderC*, %swift.error**)** [[DECODE_NEXT_ARG_REF]]
103+
// CHECK-NEXT: [[DECODER_METADATA:%.*]] = bitcast i8* %2 to %swift.type*
104+
// CHECK-NEXT: [[DECODE_NEXT_ARG_REF:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[DECODER_METADATA]], i64
106105

107-
// CHECK-NEXT: [[ARG_TYPES:%.*]] = bitcast i8* %2 to %swift.type**
108-
109-
// CHECK: [[ARG_0_TYPE_LOC:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[ARG_TYPES]], i64 0
110-
// CHECK-NEXT: %arg_type = load %swift.type*, %swift.type** [[ARG_0_TYPE_LOC]]
111-
// CHECK: %size = load i64, i64* {{.*}}
112106
// CHECK: [[ARG_0_SIZE_ADJ:%.*]] = add i64 %size, 15
113107
// CHECK-NEXT: [[ARG_0_SIZE:%.*]] = and i64 [[ARG_0_SIZE_ADJ]], -16
114108
// CHECK-NEXT: [[ARG_0_VALUE_BUF:%.*]] = call swiftcc i8* @swift_task_alloc(i64 [[ARG_0_SIZE]])
@@ -125,7 +119,7 @@ public distributed actor MyOtherActor {
125119
// CHECK: missing-witness1:
126120
// CHECK-NEXT: call void @llvm.trap()
127121
// CHECK-NEXT: unreachable
128-
// CHECK: call swiftcc void [[DECODE_NEXT_ARG]](%swift.opaque* noalias nocapture sret(%swift.opaque) [[ARG_0_RES_SLOT]], %swift.type* %arg_type, i8** [[ENCODABLE_WITNESS]], i8** [[DECODABLE_WITNESS]], %T27FakeDistributedActorSystems0A17InvocationDecoderC* swiftself [[DECODER]], %swift.error** noalias nocapture swifterror dereferenceable(8) %swifterror)
122+
// CHECK: call swiftcc void @"$s27FakeDistributedActorSystems0A17InvocationDecoderC18decodeNextArgumentxyKSeRzSERzlF"(%swift.opaque* noalias nocapture sret(%swift.opaque) %25, %swift.type* %arg_type, i8** %26, i8** %29, %T27FakeDistributedActorSystems0A17InvocationDecoderC* swiftself %15, %swift.error** noalias nocapture swifterror dereferenceable(8) %swifterror)
129123

130124
// CHECK: store %swift.error* null, %swift.error** %swifterror
131125
// CHECK-NEXT: [[ARG_0_VAL_ADDR:%.*]] = bitcast i8* [[ARG_0_VALUE_BUF]] to %TSi*

0 commit comments

Comments
 (0)