Skip to content

Commit 216e69e

Browse files
authored
Merge pull request #14973 from huonw/no-dynamic-count
[IRGen] Cond. conformance witness table count isn't needed dynamically.
2 parents babd837 + 43196c2 commit 216e69e

16 files changed

+70
-220
lines changed

include/swift/Runtime/Metadata.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,7 +2397,7 @@ struct TargetGenericWitnessTable {
23972397
/// The instantiation function, which is called after the template is copied.
23982398
RelativeDirectPointer<void(TargetWitnessTable<Runtime> *instantiatedTable,
23992399
const TargetMetadata<Runtime> *type,
2400-
void * const *instantiationArgs),
2400+
void ** const *instantiationArgs),
24012401
/*nullable*/ true> Instantiator;
24022402

24032403
using PrivateDataType = void *[swift::NumGenericMetadataPrivateDataWords];
@@ -3860,7 +3860,7 @@ SWIFT_RUNTIME_EXPORT
38603860
const WitnessTable *
38613861
swift_getGenericWitnessTable(GenericWitnessTable *genericTable,
38623862
const Metadata *type,
3863-
void * const *instantiationArgs);
3863+
void **const *instantiationArgs);
38643864

38653865
/// \brief Fetch a uniqued metadata for a function type.
38663866
SWIFT_RUNTIME_EXPORT

include/swift/Runtime/RuntimeFunctions.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,12 +818,12 @@ FUNCTION(AllocateGenericValueMetadata, swift_allocateGenericValueMetadata,
818818
// const ProtocolWitnessTable *
819819
// swift_getGenericWitnessTable(GenericProtocolWitnessTable *genericTable,
820820
// const Metadata *type,
821-
// void * const *instantiationArgs);
821+
// void ** const *instantiationArgs);
822822
FUNCTION(GetGenericWitnessTable, swift_getGenericWitnessTable, C_CC,
823823
RETURNS(WitnessTablePtrTy),
824824
ARGS(getGenericWitnessTableCacheTy()->getPointerTo(),
825825
TypeMetadataPtrTy,
826-
Int8PtrPtrTy),
826+
WitnessTablePtrPtrTy),
827827
ATTRS(NoUnwind, ReadOnly))
828828

829829
// Metadata *swift_getMetatypeMetadata(Metadata *instanceTy);

lib/IRGen/GenDecl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3987,8 +3987,7 @@ IRGenModule::getAddrOfWitnessTableAccessFunction(
39873987
// conditional requirements are passed indirectly, as an array of witness
39883988
// tables.
39893989
fnType = llvm::FunctionType::get(
3990-
WitnessTablePtrTy, {TypeMetadataPtrTy, WitnessTablePtrPtrTy, SizeTy},
3991-
false);
3990+
WitnessTablePtrTy, {TypeMetadataPtrTy, WitnessTablePtrPtrTy}, false);
39923991
} else {
39933992
fnType = llvm::FunctionType::get(WitnessTablePtrTy, false);
39943993
}

lib/IRGen/GenProto.cpp

Lines changed: 18 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ class irgen::ConformanceInfo {
990990
CanType conformingType) const = 0;
991991
};
992992

993-
static std::pair<llvm::Value *, llvm::Value *>
993+
static llvm::Value *
994994
emitConditionalConformancesBuffer(IRGenFunction &IGF, CanType conformingType,
995995
const ProtocolConformance *conformance) {
996996
// Pointers to the witness tables, in the right order, which will be included
@@ -1034,13 +1034,9 @@ emitConditionalConformancesBuffer(IRGenFunction &IGF, CanType conformingType,
10341034
return /*finished?*/ false;
10351035
});
10361036

1037-
// No conditional requirements means no need for a buffer, and size == 0 means
1038-
// no reading of the pointer.
1039-
// FIXME(cond. conf. assert): once the dynamic assertion is removed from the
1040-
// instantiation function, we can have size as undef too.
1037+
// No conditional requirements means no need for a buffer.
10411038
if (tables.empty()) {
1042-
return {llvm::UndefValue::get(IGF.IGM.WitnessTablePtrPtrTy),
1043-
llvm::ConstantInt::get(IGF.IGM.SizeTy, 0)};
1039+
return llvm::UndefValue::get(IGF.IGM.WitnessTablePtrPtrTy);
10441040
}
10451041

10461042
auto buffer = IGF.createAlloca(
@@ -1055,8 +1051,7 @@ emitConditionalConformancesBuffer(IRGenFunction &IGF, CanType conformingType,
10551051
IGF.Builder.CreateStore(tables[idx], slot);
10561052
}
10571053

1058-
auto count = llvm::ConstantInt::get(IGF.IGM.SizeTy, tables.size());
1059-
return {buffer.getAddress(), count};
1054+
return buffer.getAddress();
10601055
}
10611056

10621057
static llvm::Value *emitWitnessTableAccessorCall(
@@ -1074,12 +1069,11 @@ static llvm::Value *emitWitnessTableAccessorCall(
10741069
*srcMetadataCache = IGF.emitTypeMetadataRef(conformingType);
10751070
}
10761071

1077-
llvm::Value *conditionalTables, *numConditionalTables;
1078-
std::tie(conditionalTables, numConditionalTables) =
1072+
auto conditionalTables =
10791073
emitConditionalConformancesBuffer(IGF, conformingType, conformance);
10801074

1081-
call = IGF.Builder.CreateCall(
1082-
accessor, {*srcMetadataCache, conditionalTables, numConditionalTables});
1075+
call = IGF.Builder.CreateCall(accessor,
1076+
{*srcMetadataCache, conditionalTables});
10831077

10841078
} else {
10851079
call = IGF.Builder.CreateCall(accessor, {});
@@ -1763,17 +1757,15 @@ void WitnessTableBuilder::buildAccessFunction(llvm::Constant *wtable) {
17631757

17641758
Explosion params = IGF.collectParameters();
17651759
llvm::Value *metadata;
1766-
llvm::Value *conditionalReqtWtables;
1767-
llvm::Value *numConditionalReqtWtables;
1760+
llvm::Value *instantiationArgs;
17681761

17691762
if (Conformance.witnessTableAccessorRequiresArguments()) {
17701763
metadata = params.claimNext();
1771-
conditionalReqtWtables = params.claimNext();
1772-
numConditionalReqtWtables = params.claimNext();
1764+
instantiationArgs = params.claimNext();
17731765
} else {
17741766
metadata = llvm::ConstantPointerNull::get(IGF.IGM.TypeMetadataPtrTy);
1775-
conditionalReqtWtables = nullptr;
1776-
numConditionalReqtWtables = llvm::ConstantInt::get(IGF.IGM.SizeTy, 0);
1767+
instantiationArgs =
1768+
llvm::ConstantPointerNull::get(IGF.IGM.WitnessTablePtrPtrTy);
17771769
}
17781770

17791771
// Okay, we need a cache. Build the cache structure.
@@ -1804,7 +1796,6 @@ void WitnessTableBuilder::buildAccessFunction(llvm::Constant *wtable) {
18041796

18051797
// We need an instantiation function if the base conformance
18061798
// is non-dependent.
1807-
// TODO: the conformance might be conditional.
18081799
llvm::Constant *instantiationFn;
18091800
if (SpecializedBaseConformances.empty() &&
18101801
ConditionalRequirementPrivateDataIndices.empty()) {
@@ -1846,31 +1837,9 @@ void WitnessTableBuilder::buildAccessFunction(llvm::Constant *wtable) {
18461837
cacheData.finishAndSetAsInitializer(cache);
18471838
cache->setConstant(true);
18481839

1849-
// Create the slice structure for the conditional conformances, which is
1850-
// passed as the last argument to the instantiation function.
1851-
// FIXME(cond. conf. assert): Elide this local/replace it with `undef` once
1852-
// the size assertion in the instantiation function is gone.
1853-
auto conditionalSlice =
1854-
IGF.createAlloca(IGF.IGM.WitnessTableSliceTy,
1855-
IGF.IGM.getPointerAlignment(), "conditional.tables");
1856-
1857-
// Only store a pointer if it will be read. If not (i.e. size == 0/this
1858-
// conformance is unconditional), we can leave it as undef.
1859-
if (conditionalReqtWtables) {
1860-
auto tableSlot = IGF.Builder.CreateStructGEP(conditionalSlice, 0, Size(0));
1861-
IGF.Builder.CreateStore(conditionalReqtWtables, tableSlot);
1862-
}
1863-
1864-
auto sizeSlot = IGF.Builder.CreateStructGEP(conditionalSlice, 1,
1865-
Size(IGF.IGM.getPointerSize()));
1866-
IGF.Builder.CreateStore(numConditionalReqtWtables, sizeSlot);
1840+
auto call = IGF.Builder.CreateCall(IGM.getGetGenericWitnessTableFn(),
1841+
{cache, metadata, instantiationArgs});
18671842

1868-
auto instantiationArgs =
1869-
IGF.Builder.CreateBitCast(conditionalSlice, IGM.Int8PtrPtrTy);
1870-
1871-
auto call =
1872-
IGF.Builder.CreateCall(IGM.getGetGenericWitnessTableFn(),
1873-
{cache, metadata, instantiationArgs.getAddress()});
18741843
call->setDoesNotThrow();
18751844

18761845
IGF.Builder.CreateRet(call);
@@ -1890,39 +1859,11 @@ llvm::Constant *WitnessTableBuilder::buildInstantiationFunction() {
18901859
Explosion params = IGF.collectParameters();
18911860
Address wtable(params.claimNext(), PointerAlignment);
18921861
llvm::Value *metadata = params.claimNext();
1893-
Address instantiationArgs(params.claimNext(), PointerAlignment);
1894-
1895-
// The details of any conditional conformances are in the last argument, as a
1896-
// pointer/size pair.
1897-
auto conditionalTablesSlice = IGF.Builder.CreateElementBitCast(
1898-
instantiationArgs, IGF.IGM.WitnessTableSliceTy);
1899-
1900-
auto conditionalTablesPtr =
1901-
IGF.Builder.CreateStructGEP(conditionalTablesSlice, 0, Size(0));
1902-
Address conditionalTables(IGF.Builder.CreateLoad(conditionalTablesPtr),
1903-
PointerAlignment);
1904-
1905-
auto numConditionalTablesPtr =
1906-
IGF.Builder.CreateStructGEP(conditionalTablesSlice, 1, Size(PointerSize));
1907-
auto numConditionalTables = IGF.Builder.CreateLoad(numConditionalTablesPtr);
1908-
1909-
// Assert that the number of witness tables passed in is the number required
1910-
// for the conditional conformances of this witness table.
1911-
1912-
// FIXME(cond. conf. assert): remove this once we're confident in conditional
1913-
// conformances and especially dynamic casting. (Look for the other
1914-
// 'cond. conf. assert' FIXMEs too.)
1915-
auto failBB = IGF.createBasicBlock("bad_witness_table_count");
1916-
auto contBB = IGF.createBasicBlock("cont");
1917-
1918-
auto cmp = IGF.Builder.CreateICmpEQ(
1919-
numConditionalTables,
1920-
llvm::ConstantInt::get(IGM.SizeTy,
1921-
ConditionalRequirementPrivateDataIndices.size()));
1922-
IGF.Builder.CreateCondBr(cmp, contBB, failBB);
1923-
1924-
// All good: now we can actually fill in the witness table.
1925-
IGF.Builder.emitBlock(contBB);
1862+
llvm::Value *instantiationArgs = params.claimNext();
1863+
Address conditionalTables(
1864+
IGF.Builder.CreateBitCast(instantiationArgs,
1865+
IGF.IGM.WitnessTablePtrPtrTy),
1866+
PointerAlignment);
19261867

19271868
/// Run through the conditional conformance witness tables, pulling them out
19281869
/// of the slice and putting them into the private data of the witness table.
@@ -1967,10 +1908,6 @@ llvm::Constant *WitnessTableBuilder::buildInstantiationFunction() {
19671908

19681909
IGF.Builder.CreateRetVoid();
19691910

1970-
// The counts didn't match; abort.
1971-
IGF.Builder.emitBlock(failBB);
1972-
IGF.emitTrap(/*EmitUnreachable=*/true);
1973-
19741911
return fn;
19751912
}
19761913

lib/IRGen/IRGenModule.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,6 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
398398
OpenedErrorTriplePtrTy = OpenedErrorTripleTy->getPointerTo(DefaultAS);
399399

400400
WitnessTablePtrPtrTy = WitnessTablePtrTy->getPointerTo(DefaultAS);
401-
WitnessTableSliceTy = createStructType(*this, "swift.witness_table_slice",
402-
{WitnessTablePtrPtrTy, SizeTy});
403401

404402
InvariantMetadataID = LLVMContext.getMDKindID("invariant.load");
405403
InvariantNode = llvm::MDNode::get(LLVMContext, {});

lib/IRGen/IRGenModule.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,6 @@ class IRGenModule {
557557
llvm::StructType *OpenedErrorTripleTy; /// { %swift.opaque*, %swift.type*, i8** }
558558
llvm::PointerType *OpenedErrorTriplePtrTy; /// { %swift.opaque*, %swift.type*, i8** }*
559559
llvm::PointerType *WitnessTablePtrPtrTy; /// i8***
560-
llvm::StructType *WitnessTableSliceTy; /// { witness_table**, i64 }
561560

562561
/// Used to create unique names for class layout types with tail allocated
563562
/// elements.

stdlib/public/runtime/Metadata.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3042,9 +3042,10 @@ allocateWitnessTable(GenericWitnessTable *genericTable,
30423042
return entry;
30433043
}
30443044

3045-
const WitnessTable *swift::swift_getGenericWitnessTable(
3046-
GenericWitnessTable *genericTable, const Metadata *type,
3047-
void *const *instantiationArgs) {
3045+
const WitnessTable *
3046+
swift::swift_getGenericWitnessTable(GenericWitnessTable *genericTable,
3047+
const Metadata *type,
3048+
void **const *instantiationArgs) {
30483049
if (doesNotRequireInstantiation(genericTable)) {
30493050
return genericTable->Pattern;
30503051
}

test/IRGen/associated_type_witness.swift

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,9 @@ struct Computed<T, U> : Assocked {
134134
// CHECK-NEXT: br label %cont
135135

136136
// Witness table accessor function for Computed : Assocked.
137-
// CHECK-LABEL: define hidden i8** @"$S23associated_type_witness15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWa"(%swift.type*, i8***, i64)
138-
// CHECK: entry:
139-
// CHECK-NEXT: %conditional.tables = alloca %swift.witness_table_slice, align 8
140-
// CHECK-NEXT: [[TABLES:%.*]] = getelementptr inbounds %swift.witness_table_slice, %swift.witness_table_slice* %conditional.tables, i32 0, i32 0
141-
// CHECK-NEXT: store i8*** %1, i8**** [[TABLES]], align 8
142-
// CHECK-NEXT: [[COUNT:%.*]] = getelementptr inbounds %swift.witness_table_slice, %swift.witness_table_slice* %conditional.tables, i32 0, i32 1
143-
// CHECK-NEXT: store i64 %2, i64* [[COUNT]], align 8
144-
// CHECK-NEXT: [[INSTANTIATION_ARGS:%.*]] = bitcast %swift.witness_table_slice* %conditional.tables to i8**
145-
// CHECK-NEXT: [[WTABLE:%.*]] = call i8** @swift_getGenericWitnessTable(%swift.generic_witness_table_cache* @"$S23associated_type_witness15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWG", %swift.type* %0, i8** [[INSTANTIATION_ARGS]])
137+
// CHECK-LABEL: define hidden i8** @"$S23associated_type_witness15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWa"(%swift.type*, i8***)
138+
// CHECK-NEXT: entry:
139+
// CHECK-NEXT: [[WTABLE:%.*]] = call i8** @swift_getGenericWitnessTable(%swift.generic_witness_table_cache* @"$S23associated_type_witness15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWG", %swift.type* %0, i8*** %1)
146140
// CHECK-NEXT: ret i8** [[WTABLE]]
147141

148142

@@ -176,22 +170,16 @@ struct GenericComputed<T: P> : DerivedFromSimpleAssoc {
176170

177171
// Instantiation function for GenericComputed : DerivedFromSimpleAssoc.
178172
// CHECK-LABEL: define internal void @"$S23associated_type_witness15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWI"(i8**, %swift.type*, i8**)
179-
// CHECK: [[T0:%.*]] = call i8** @"$S23associated_type_witness15GenericComputedVyxGAA14HasSimpleAssocAAWa"(%swift.type* %1, i8*** undef, i64 0)
173+
// CHECK: [[T0:%.*]] = call i8** @"$S23associated_type_witness15GenericComputedVyxGAA14HasSimpleAssocAAWa"(%swift.type* %1, i8*** undef)
180174
// CHECK-NEXT: [[T1:%.*]] = bitcast i8** [[T0]] to i8*
181175
// CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds i8*, i8** %0, i32 1
182176
// CHECK-NEXT: store i8* [[T1]], i8** [[T2]], align 8
183177
// CHECK-NEXT: ret void
184178

185179
// Witness table accessor function for GenericComputed : HasSimpleAssoc..
186-
// CHECK-LABEL: define hidden i8** @"$S23associated_type_witness15GenericComputedVyxGAA14HasSimpleAssocAAWa"(%swift.type*, i8***, i64)
180+
// CHECK-LABEL: define hidden i8** @"$S23associated_type_witness15GenericComputedVyxGAA14HasSimpleAssocAAWa"(%swift.type*, i8***)
187181
// CHECK-NEXT: entry:
188-
// CHECK-NEXT: %conditional.tables = alloca %swift.witness_table_slice, align 8
189-
// CHECK-NEXT: [[TABLES:%.*]] = getelementptr inbounds %swift.witness_table_slice, %swift.witness_table_slice* %conditional.tables, i32 0, i32 0
190-
// CHECK-NEXT: store i8*** %1, i8**** [[TABLES]], align 8
191-
// CHECK-NEXT: [[COUNT:%.*]] = getelementptr inbounds %swift.witness_table_slice, %swift.witness_table_slice* %conditional.tables, i32 0, i32 1
192-
// CHECK-NEXT: store i64 %2, i64* [[COUNT]], align 8
193-
// CHECK-NEXT: [[INSTANTIATION_ARGS:%.*]] = bitcast %swift.witness_table_slice* %conditional.tables to i8**
194-
// CHECK-NEXT: [[WTABLE:%.*]] = call i8** @swift_getGenericWitnessTable(%swift.generic_witness_table_cache* @"$S23associated_type_witness15GenericComputedVyxGAA14HasSimpleAssocAAWG", %swift.type* %0, i8** [[INSTANTIATION_ARGS]])
182+
// CHECK-NEXT: [[WTABLE:%.*]] = call i8** @swift_getGenericWitnessTable(%swift.generic_witness_table_cache* @"$S23associated_type_witness15GenericComputedVyxGAA14HasSimpleAssocAAWG", %swift.type* %0, i8*** %1)
195183
// CHECK-NEXT: ret i8** [[WTABLE]]
196184

197185

test/IRGen/partial_apply_forwarder.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ sil hidden_external @takingEmptyAndQ : $@convention(thin) <τ_0_0 where τ_0_0
9494
// CHECK: [[GENPARAMSADDR:%.*]] = bitcast %swift.type* [[TY]] to %swift.type**
9595
// CHECK: [[PARAMTYADDR:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[GENPARAMSADDR]], {{(i64 10|i32 13)}}
9696
// CHECK: %"BaseProducer<\CF\84_0_1>" = load %swift.type*, %swift.type** [[PARAMTYADDR]]
97-
// CHECK: [[WITNESS:%.*]] = call i8** @"$S23partial_apply_forwarder12BaseProducerVyxGAA1QAAWa"(%swift.type* %"BaseProducer<\CF\84_0_1>", i8*** undef, {{i32|i64}} 0)
97+
// CHECK: [[WITNESS:%.*]] = call i8** @"$S23partial_apply_forwarder12BaseProducerVyxGAA1QAAWa"(%swift.type* %"BaseProducer<\CF\84_0_1>", i8*** undef)
9898
// CHECK: [[OBJ:%.*]] = bitcast %swift.refcounted* %0 to %T23partial_apply_forwarder7WeakBoxC.1*
9999
// CHECK: tail call swiftcc void @takingQ(%T23partial_apply_forwarder7WeakBoxC.1* [[OBJ]], i8** [[WITNESS]])
100100
// CHECK: }
@@ -151,7 +151,7 @@ bb0(%0 : $*τ_0_1, %2: $EmptyType):
151151
// CHECK: [[TYPARAMSADDR:%.*]] = bitcast %swift.type* [[TY]] to %swift.type**
152152
// CHECK: [[TYPARAM:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[TYPARAMSADDR]], {{(i64 10|i32 13)}}
153153
// CHECK: %"BaseProducer<\CF\84_0_1>" = load %swift.type*, %swift.type** [[TYPARAM]]
154-
// CHECK: [[WITNESS:%.*]] = call i8** @"$S23partial_apply_forwarder12BaseProducerVyxGAA1QAAWa"(%swift.type* %"BaseProducer<\CF\84_0_1>", i8*** undef, {{i32|i64}} 0)
154+
// CHECK: [[WITNESS:%.*]] = call i8** @"$S23partial_apply_forwarder12BaseProducerVyxGAA1QAAWa"(%swift.type* %"BaseProducer<\CF\84_0_1>", i8*** undef)
155155
// CHECK: tail call swiftcc void @takingQ(%T23partial_apply_forwarder7WeakBoxC.1* [[CAST]], i8** [[WITNESS]])
156156
// CHECK: ret void
157157

@@ -203,7 +203,7 @@ sil hidden_external @takingQAndS : $@convention(thin) <τ_0_0 where τ_0_0 : Q>
203203
// CHECK: [[GENPARAMSADDR:%.*]] = bitcast %swift.type* [[TY]] to %swift.type**
204204
// CHECK: [[GENPARAMADDR:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[GENPARAMSADDR]], {{(i64 10|i32 13)}}
205205
// CHECK: %"BaseProducer<\CF\84_0_1>" = load %swift.type*, %swift.type** [[GENPARAMADDR]]
206-
// CHECK: [[WITNESS:%.*]] = call i8** @"$S23partial_apply_forwarder12BaseProducerVyxGAA1QAAWa"(%swift.type* %"BaseProducer<\CF\84_0_1>", i8*** undef, {{i32|i64}} 0)
206+
// CHECK: [[WITNESS:%.*]] = call i8** @"$S23partial_apply_forwarder12BaseProducerVyxGAA1QAAWa"(%swift.type* %"BaseProducer<\CF\84_0_1>", i8*** undef)
207207
// CHECK: tail call swiftcc void @takingQAndS(i64 [[X]], %T23partial_apply_forwarder7WeakBoxC.1* %.asUnsubstituted, i8** [[WITNESS]])
208208

209209
sil public @bind_polymorphic_param_from_context_with_layout : $@convention(thin) <τ_0_1>(@in τ_0_1, S) -> @owned @callee_owned () -> () {

test/IRGen/protocol_resilience.sil

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,7 @@ bb0(%0 : $*ResilientConformingType):
296296

297297
// CHECK-LABEL: define{{( protected)?}} i8** @"$S19protocol_resilience23ResilientConformingTypeV010resilient_A005OtherC8ProtocolAAWa"()
298298
// CHECK-NEXT: entry:
299-
// CHECK-NEXT: %conditional.tables = alloca %swift.witness_table_slice
300-
// CHECK-NEXT: [[COUNT_PTR:%.*]] = getelementptr inbounds %swift.witness_table_slice, %swift.witness_table_slice* %conditional.tables, i32 0, i32 1
301-
// CHECK-NEXT: store [[WORD:i(32|64)]] 0, [[WORD:i(32|64)]]* [[COUNT_PTR]]
302-
// CHECK-NEXT: [[INSTANTIATION_ARGS:%.*]] = bitcast %swift.witness_table_slice* %conditional.tables to i8**
303-
// CHECK-NEXT: [[WTABLE:%.*]] = call i8** @swift_getGenericWitnessTable(%swift.generic_witness_table_cache* @"$S19protocol_resilience23ResilientConformingTypeV010resilient_A005OtherC8ProtocolAAWG", %swift.type* null, i8** [[INSTANTIATION_ARGS]])
299+
// CHECK-NEXT: [[WTABLE:%.*]] = call i8** @swift_getGenericWitnessTable(%swift.generic_witness_table_cache* @"$S19protocol_resilience23ResilientConformingTypeV010resilient_A005OtherC8ProtocolAAWG", %swift.type* null, i8*** null)
304300
// CHECK-NEXT: ret i8** [[WTABLE]]
305301

306302

test/IRGen/witness_method.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct SyncUp<Deliverable> : Synergy {
6565
// CHECK-LABEL: define{{( protected)?}} swiftcc void @testGenericWitnessMethod(%swift.opaque* noalias nocapture sret, %T14witness_method6SyncUpV* noalias nocapture, %swift.type* %T)
6666
// CHECK: entry:
6767
// CHECK: [[METADATA:%.*]] = call %swift.type* @"$S14witness_method6SyncUpVMa"(%swift.type* %T)
68-
// CHECK: [[WTABLE:%.*]] = call i8** @"$S14witness_method6SyncUpVyxGAA7SynergyAAWa"(%swift.type* [[METADATA]], i8*** undef, {{i32|i64}} 0)
68+
// CHECK: [[WTABLE:%.*]] = call i8** @"$S14witness_method6SyncUpVyxGAA7SynergyAAWa"(%swift.type* [[METADATA]], i8*** undef)
6969
// CHECK: [[WITNESS_ADDR:%.*]] = getelementptr inbounds i8*, i8** [[WTABLE]], i32 2
7070
// CHECK: [[WITNESS_FN:%.*]] = load i8*, i8** [[WITNESS_ADDR]]
7171
// CHECK: [[WITNESS:%.*]] = bitcast i8* [[WITNESS_FN]] to void (%swift.opaque*, %swift.opaque*, %swift.type*, i8**)*

0 commit comments

Comments
 (0)