Skip to content

Commit e4b13d0

Browse files
authored
Merge pull request #6970 from compnerd/_specialize
2 parents 559d1c3 + 4ae6bf1 commit e4b13d0

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

lib/SILOptimizer/IPO/EagerSpecializer.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ namespace {
220220
/// Helper class for emitting code to dispatch to a specialized function.
221221
class EagerDispatch {
222222
SILFunction *GenericFunc;
223+
#if 0
223224
const SILSpecializeAttr &SA;
225+
#endif
224226
const ReabstractionInfo &ReInfo;
225227

226228
SILBuilder Builder;
@@ -231,12 +233,11 @@ class EagerDispatch {
231233
// original generic function.
232234
EagerDispatch(SILFunction *GenericFunc, const SILSpecializeAttr &SA,
233235
const ReabstractionInfo &ReInfo)
234-
: GenericFunc(GenericFunc), SA(SA), ReInfo(ReInfo), Builder(*GenericFunc),
235-
Loc(GenericFunc->getLocation()) {
236-
236+
: GenericFunc(GenericFunc), ReInfo(ReInfo), Builder(*GenericFunc),
237+
Loc(GenericFunc->getLocation()) {
237238
Builder.setCurrentDebugScope(GenericFunc->getDebugScope());
238239
}
239-
240+
240241
void emitDispatchTo(SILFunction *NewFunc);
241242

242243
protected:
@@ -264,12 +265,12 @@ void EagerDispatch::emitDispatchTo(SILFunction *NewFunc) {
264265
// Iterate over all dependent types in the generic signature, which will match
265266
// the specialized attribute's substitution list. Visit only
266267
// SubstitutableTypes, skipping DependentTypes.
267-
auto GenericSig =
268-
GenericFunc->getLoweredFunctionType()->getGenericSignature();
269-
270268
// TODO: Uncomment when Generics.cpp is updated to use the
271269
// new @_specialize attribute for partial specializations.
272270
#if 0
271+
auto GenericSig =
272+
GenericFunc->getLoweredFunctionType()->getGenericSignature();
273+
273274
auto SubIt = SA.getSubstitutions().begin();
274275
auto SubEnd = SA.getSubstitutions().end();
275276
for (auto DepTy : GenericSig->getAllDependentTypes()) {
@@ -281,6 +282,8 @@ void EagerDispatch::emitDispatchTo(SILFunction *NewFunc) {
281282
}
282283
assert(SubIt == SubEnd && "Too many substitutions.");
283284
(void) SubEnd;
285+
#else
286+
static_cast<void>(FailedTypeCheckBB);
284287
#endif
285288
// 2. Convert call arguments, casting and adjusting for calling convention.
286289

@@ -432,6 +435,9 @@ class EagerSpecializerTransform : public SILModuleTransform {
432435
};
433436
} // end anonymous namespace
434437

438+
// TODO: Uncomment when Generics.cpp is updated to use the
439+
// new @_specialize attribute for partial specializations.
440+
#if 0
435441
/// Specializes a generic function for a concrete type list.
436442
static SILFunction *eagerSpecialize(SILFunction *GenericFunc,
437443
const SILSpecializeAttr &SA,
@@ -466,6 +472,7 @@ static SILFunction *eagerSpecialize(SILFunction *GenericFunc,
466472
return nullptr;
467473
#endif
468474
}
475+
#endif
469476

470477
/// Run the pass.
471478
void EagerSpecializerTransform::run() {

0 commit comments

Comments
 (0)