@@ -153,16 +153,19 @@ static bool specializeVTablesOfSuperclasses(SILModule &module,
153
153
SILVTable *swift::specializeVTableForType (SILType classTy, SILModule &module ,
154
154
SILTransform *transform) {
155
155
CanType astType = classTy.getASTType ();
156
- BoundGenericClassType *genClassTy = dyn_cast<BoundGenericClassType>(astType);
157
- if (!genClassTy) return nullptr ;
156
+ if (!astType->isSpecialized ())
157
+ return nullptr ;
158
+ NominalOrBoundGenericNominalType *genClassTy = dyn_cast<NominalOrBoundGenericNominalType>(astType);
159
+ ClassDecl *classDecl = astType->getClassOrBoundGenericClass ();
160
+ if (!classDecl)
161
+ return nullptr ;
158
162
159
163
if (module .lookUpSpecializedVTable (classTy)) return nullptr ;
160
164
161
165
LLVM_DEBUG (llvm::errs () << " specializeVTableFor "
162
- << genClassTy-> getDecl () ->getName () << ' '
166
+ << classDecl ->getName () << ' '
163
167
<< genClassTy->getString () << ' \n ' );
164
168
165
- ClassDecl *classDecl = genClassTy->getDecl ();
166
169
SILVTable *origVtable = module .lookUpVTable (classDecl);
167
170
if (!origVtable) {
168
171
// This cannot occur in regular builds - only if built without wmo, which
@@ -244,8 +247,8 @@ bool swift::specializeClassMethodInst(ClassMethodInst *cm) {
244
247
SILValue instance = cm->getOperand ();
245
248
SILType classTy = instance->getType ();
246
249
CanType astType = classTy.getASTType ();
247
- BoundGenericClassType *genClassTy = dyn_cast<BoundGenericClassType>( astType);
248
- if (!genClassTy) return false ;
250
+ if (! astType-> isSpecialized ())
251
+ return false ;
249
252
250
253
SubstitutionMap subs = astType->getContextSubstitutionMap ();
251
254
0 commit comments