@@ -849,19 +849,9 @@ void IRGenerator::emitGlobalTopLevel() {
849
849
// Emit witness tables.
850
850
for (SILWitnessTable &wt : PrimaryIGM->getSILModule ().getWitnessTableList ()) {
851
851
CurrentIGMPtr IGM = getGenModule (wt.getConformance ()->getDeclContext ());
852
- #ifndef NDEBUG
853
- IGM->EligibleConfs .collect (&wt);
854
- IGM->CurrentWitnessTable = &wt;
855
- #endif
856
-
857
852
if (!canEmitWitnessTableLazily (&wt)) {
858
853
IGM->emitSILWitnessTable (&wt);
859
854
}
860
-
861
- #ifndef NDEBUG
862
- IGM->EligibleConfs .clear ();
863
- IGM->CurrentWitnessTable = nullptr ;
864
- #endif
865
855
}
866
856
867
857
for (auto Iter : *this ) {
@@ -1895,83 +1885,6 @@ IRGenModule::getAddrOfLLVMVariable(LinkEntity entity, Alignment alignment,
1895
1885
llvm_unreachable (" bad reference kind" );
1896
1886
}
1897
1887
1898
- void IRGenModule::checkEligibleConf (const ProtocolConformance *Conf) {
1899
- #ifndef NDEBUG
1900
- if (!ConformanceCollector::verifyInIRGen ())
1901
- return ;
1902
-
1903
- if (EligibleConfs.isUsed (Conf))
1904
- return ;
1905
-
1906
- if (CurrentInst) {
1907
- llvm::errs () << " ## Conformance: " ;
1908
- Conf->dump ();
1909
- llvm::errs () << " ## Inst: " ;
1910
- CurrentInst->dump ();
1911
- llvm_unreachable (
1912
- " ConformanceCollector is missing a conformance in instruction" );
1913
- }
1914
- if (CurrentWitnessTable) {
1915
- llvm_unreachable (
1916
- " ConformanceCollector is missing a conformance in witness table" );
1917
- }
1918
- #endif
1919
- }
1920
-
1921
- void IRGenModule::checkEligibleMetaType (NominalTypeDecl *NT) {
1922
- #ifndef NDEBUG
1923
- if (!ConformanceCollector::verifyInIRGen ())
1924
- return ;
1925
-
1926
- if (!NT || EligibleConfs.isMetaTypeEscaping (NT))
1927
- return ;
1928
-
1929
- if (CurrentInst) {
1930
- // Ignore instructions which may use a metatype but do not let escape it.
1931
- switch (CurrentInst->getKind ()) {
1932
- case ValueKind::DestroyAddrInst:
1933
- case ValueKind::StructElementAddrInst:
1934
- case ValueKind::TupleElementAddrInst:
1935
- case ValueKind::InjectEnumAddrInst:
1936
- case ValueKind::SwitchEnumAddrInst:
1937
- case ValueKind::SelectEnumAddrInst:
1938
- case ValueKind::IndexAddrInst:
1939
- case ValueKind::RefElementAddrInst:
1940
- case ValueKind::RefTailAddrInst:
1941
- case ValueKind::TailAddrInst:
1942
- case ValueKind::AllocValueBufferInst:
1943
- case ValueKind::ProjectValueBufferInst:
1944
- case ValueKind::ProjectBoxInst:
1945
- case ValueKind::CopyAddrInst:
1946
- case ValueKind::UncheckedRefCastAddrInst:
1947
- case ValueKind::AllocStackInst:
1948
- case ValueKind::SuperMethodInst:
1949
- case ValueKind::WitnessMethodInst:
1950
- case ValueKind::DeallocRefInst:
1951
- case ValueKind::AllocGlobalInst:
1952
- return ;
1953
- case ValueKind::ApplyInst:
1954
- case ValueKind::TryApplyInst:
1955
- case ValueKind::PartialApplyInst:
1956
- // It's not trivial to find the non-escaping vs. escaping meta-
1957
- // types of an apply. Therefore we just trust the ConformanceCollector
1958
- // that it does the right job.
1959
- return ;
1960
- default :
1961
- break ;
1962
- }
1963
- llvm::errs () << " ## NominalType: " << NT->getName () << " \n ## Inst: " ;
1964
- CurrentInst->dump ();
1965
- llvm_unreachable (
1966
- " ConformanceCollector is missing a metatype in instruction" );
1967
- }
1968
- if (CurrentWitnessTable) {
1969
- llvm_unreachable (
1970
- " ConformanceCollector is missing a metatype in witness table" );
1971
- }
1972
- #endif
1973
- }
1974
-
1975
1888
// / A convenient wrapper around getAddrOfLLVMVariable which uses the
1976
1889
// / default type as the definition type.
1977
1890
llvm::Constant *
@@ -2513,7 +2426,6 @@ IRGenModule::getAddrOfTypeMetadataAccessFunction(CanType type,
2513
2426
ForDefinition_t forDefinition) {
2514
2427
assert (!type->hasArchetype () && !type->hasTypeParameter ());
2515
2428
NominalTypeDecl *Nominal = type->getNominalOrBoundGenericNominal ();
2516
- checkEligibleMetaType (Nominal);
2517
2429
IRGen.addLazyTypeMetadata (Nominal);
2518
2430
2519
2431
LinkEntity entity = LinkEntity::forTypeMetadataAccessFunction (type);
@@ -2537,7 +2449,6 @@ IRGenModule::getAddrOfGenericTypeMetadataAccessFunction(
2537
2449
ForDefinition_t forDefinition) {
2538
2450
assert (!genericArgs.empty ());
2539
2451
assert (nominal->isGenericContext ());
2540
- checkEligibleMetaType (nominal);
2541
2452
IRGen.addLazyTypeMetadata (nominal);
2542
2453
2543
2454
auto type = nominal->getDeclaredType ()->getCanonicalType ();
@@ -2561,7 +2472,6 @@ llvm::Constant *
2561
2472
IRGenModule::getAddrOfTypeMetadataLazyCacheVariable (CanType type,
2562
2473
ForDefinition_t forDefinition) {
2563
2474
assert (!type->hasArchetype () && !type->hasTypeParameter ());
2564
- checkEligibleMetaType (type->getNominalOrBoundGenericNominal ());
2565
2475
LinkEntity entity = LinkEntity::forTypeMetadataLazyCacheVariable (type);
2566
2476
return getAddrOfLLVMVariable (entity, getPointerAlignment (), forDefinition,
2567
2477
TypeMetadataPtrTy, DebugTypeInfo ());
@@ -2712,7 +2622,6 @@ ConstantReference IRGenModule::getAddrOfTypeMetadata(CanType concreteType,
2712
2622
SymbolReferenceKind refKind) {
2713
2623
assert (isPattern || !isa<UnboundGenericType>(concreteType));
2714
2624
2715
- checkEligibleMetaType (concreteType->getNominalOrBoundGenericNominal ());
2716
2625
llvm::Type *defaultVarTy;
2717
2626
unsigned adjustmentIndex;
2718
2627
Alignment alignment = getPointerAlignment ();
@@ -2807,7 +2716,6 @@ ConstantReference IRGenModule::getAddrOfTypeMetadata(CanType concreteType,
2807
2716
llvm::Constant *IRGenModule::getAddrOfNominalTypeDescriptor (NominalTypeDecl *D,
2808
2717
ConstantInitFuture definition) {
2809
2718
assert (definition && " not defining nominal type descriptor?" );
2810
- checkEligibleMetaType (D);
2811
2719
auto entity = LinkEntity::forNominalTypeDescriptor (D);
2812
2720
return getAddrOfLLVMVariable (entity, getPointerAlignment (),
2813
2721
definition,
@@ -3181,7 +3089,6 @@ IRGenModule::getResilienceExpansionForLayout(SILGlobalVariable *global) {
3181
3089
llvm::Constant *IRGenModule::
3182
3090
getAddrOfGenericWitnessTableCache (const NormalProtocolConformance *conf,
3183
3091
ForDefinition_t forDefinition) {
3184
- checkEligibleConf (conf);
3185
3092
auto entity = LinkEntity::forGenericProtocolWitnessTableCache (conf);
3186
3093
auto expectedTy = getGenericWitnessTableCacheTy ();
3187
3094
return getAddrOfLLVMVariable (entity, getPointerAlignment (), forDefinition,
@@ -3191,7 +3098,6 @@ getAddrOfGenericWitnessTableCache(const NormalProtocolConformance *conf,
3191
3098
llvm::Function *
3192
3099
IRGenModule::getAddrOfGenericWitnessTableInstantiationFunction (
3193
3100
const NormalProtocolConformance *conf) {
3194
- checkEligibleConf (conf);
3195
3101
auto forDefinition = ForDefinition;
3196
3102
3197
3103
LinkEntity entity =
@@ -3238,8 +3144,6 @@ llvm::Function *
3238
3144
IRGenModule::getAddrOfWitnessTableAccessFunction (
3239
3145
const NormalProtocolConformance *conf,
3240
3146
ForDefinition_t forDefinition) {
3241
- checkEligibleConf (conf);
3242
-
3243
3147
IRGen.addLazyWitnessTable (conf);
3244
3148
3245
3149
LinkEntity entity = LinkEntity::forProtocolWitnessTableAccessFunction (conf);
@@ -3268,7 +3172,6 @@ IRGenModule::getAddrOfWitnessTableLazyAccessFunction(
3268
3172
const NormalProtocolConformance *conf,
3269
3173
CanType conformingType,
3270
3174
ForDefinition_t forDefinition) {
3271
- checkEligibleConf (conf);
3272
3175
LinkEntity entity =
3273
3176
LinkEntity::forProtocolWitnessTableLazyAccessFunction (conf, conformingType);
3274
3177
llvm::Function *&entry = GlobalFuncs[entity];
@@ -3293,7 +3196,6 @@ IRGenModule::getAddrOfWitnessTableLazyCacheVariable(
3293
3196
CanType conformingType,
3294
3197
ForDefinition_t forDefinition) {
3295
3198
assert (!conformingType->hasArchetype ());
3296
- checkEligibleConf (conf);
3297
3199
LinkEntity entity =
3298
3200
LinkEntity::forProtocolWitnessTableLazyCacheVariable (conf, conformingType);
3299
3201
return getAddrOfLLVMVariable (entity, getPointerAlignment (),
@@ -3310,7 +3212,6 @@ IRGenModule::getAddrOfWitnessTableLazyCacheVariable(
3310
3212
llvm::Constant*
3311
3213
IRGenModule::getAddrOfWitnessTable (const NormalProtocolConformance *conf,
3312
3214
ConstantInit definition) {
3313
- checkEligibleConf (conf);
3314
3215
IRGen.addLazyWitnessTable (conf);
3315
3216
3316
3217
auto entity = LinkEntity::forDirectProtocolWitnessTable (conf);
@@ -3322,7 +3223,6 @@ llvm::Function *
3322
3223
IRGenModule::getAddrOfAssociatedTypeMetadataAccessFunction (
3323
3224
const NormalProtocolConformance *conformance,
3324
3225
AssociatedTypeDecl *associate) {
3325
- checkEligibleConf (conformance);
3326
3226
auto forDefinition = ForDefinition;
3327
3227
3328
3228
LinkEntity entity =
@@ -3344,7 +3244,6 @@ IRGenModule::getAddrOfAssociatedTypeWitnessTableAccessFunction(
3344
3244
const NormalProtocolConformance *conformance,
3345
3245
CanType associatedType,
3346
3246
ProtocolDecl *associatedProtocol) {
3347
- checkEligibleConf (conformance);
3348
3247
auto forDefinition = ForDefinition;
3349
3248
3350
3249
LinkEntity entity =
0 commit comments