@@ -375,31 +375,6 @@ class TypeSubstCloner : public SILClonerWithScopes<ImplClass> {
375
375
getOpValue (dfei->getOperand ()), remappedDerivativeFnType));
376
376
}
377
377
378
- // / One abstract function in the debug info can only have one set of variables
379
- // / and types. This function determines whether applying the substitutions in
380
- // / \p SubsMap on the generic signature \p Sig will change the generic type
381
- // / parameters in the signature. This is used to decide whether it's necessary
382
- // / to clone a unique copy of the function declaration with the substitutions
383
- // / applied for the debug info.
384
- static bool substitutionsChangeGenericTypeParameters (SubstitutionMap SubsMap,
385
- GenericSignature Sig) {
386
-
387
- // If there are no substitutions, just reuse
388
- // the original decl.
389
- if (SubsMap.empty ())
390
- return false ;
391
-
392
- bool Result = false ;
393
- Sig->forEachParam ([&](GenericTypeParamType *ParamType, bool Canonical) {
394
- if (!Canonical)
395
- return ;
396
- if (!Type (ParamType).subst (SubsMap)->isEqual (ParamType))
397
- Result = true ;
398
- });
399
-
400
- return Result;
401
- }
402
-
403
378
enum { ForInlining = true };
404
379
// / Helper function to clone the parent function of a SILDebugScope if
405
380
// / necessary when inlining said function into a new generic context.
@@ -420,7 +395,11 @@ class TypeSubstCloner : public SILClonerWithScopes<ImplClass> {
420
395
if (SubsMap.hasArchetypes ())
421
396
SubsMap = SubsMap.mapReplacementTypesOutOfContext ();
422
397
423
- if (!substitutionsChangeGenericTypeParameters (SubsMap, RemappedSig))
398
+ // One abstract function in the debug info can only have one set of variables
399
+ // and types. We check if the function is called with non-identity substitutions
400
+ // to decide whether it's necessary to clone a unique copy of the function
401
+ // declaration with the substitutions applied for the debug info.
402
+ if (SubsMap.isIdentity ())
424
403
return ParentFunction;
425
404
426
405
// Note that mapReplacementTypesOutOfContext() can't do anything for
0 commit comments