Skip to content

Commit dca75c4

Browse files
committed
IRGen: revert hack to look for specialized deinits
1 parent 9816de3 commit dca75c4

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

lib/IRGen/GenType.cpp

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "swift/Basic/Platform.h"
2727
#include "swift/Basic/SourceManager.h"
2828
#include "swift/IRGen/Linking.h"
29-
#include "swift/SIL/GenericSpecializationMangler.h"
3029
#include "swift/SIL/SILModule.h"
3130
#include "llvm/IR/DerivedTypes.h"
3231
#include "llvm/ADT/SmallString.h"
@@ -2938,34 +2937,20 @@ static bool tryEmitDeinitCall(IRGenFunction &IGF,
29382937
return true;
29392938
}
29402939

2941-
auto deinitSILFn = deinitTable->getImplementation();
2942-
2943-
// Look for a specialization of deinit that we can call.
2944-
auto substitutions = ty->getContextSubstitutionMap();
2945-
if (!substitutions.empty() &&
2946-
!substitutions.getRecursiveProperties().hasArchetype()) {
2947-
Mangle::GenericSpecializationMangler mangler(
2948-
deinitSILFn->getASTContext(), deinitSILFn,
2949-
deinitSILFn->getSerializedKind());
2950-
2951-
auto specializedName = mangler.mangleReabstracted(
2952-
substitutions, /*needAlternativeMangling=*/false);
2953-
auto specializedFn = IGF.IGM.getSILModule().lookUpFunction(specializedName);
2954-
if (specializedFn)
2955-
deinitSILFn = specializedFn;
2956-
}
2957-
29582940
// The deinit should take a single value parameter of the nominal type, either
29592941
// by @owned or indirect @in convention.
2960-
auto deinitFn = IGF.IGM.getAddrOfSILFunction(deinitSILFn, NotForDefinition);
2961-
auto deinitTy = deinitSILFn->getLoweredFunctionType();
2942+
auto deinitFn = IGF.IGM.getAddrOfSILFunction(deinitTable->getImplementation(),
2943+
NotForDefinition);
2944+
auto deinitTy = deinitTable->getImplementation()->getLoweredFunctionType();
29622945
auto deinitFP = FunctionPointer::forDirect(IGF.IGM, deinitFn,
29632946
nullptr, deinitTy);
29642947
assert(deinitTy->getNumParameters() == 1
29652948
&& deinitTy->getNumResults() == 0
29662949
&& !deinitTy->hasError()
29672950
&& "deinit should have only one parameter");
29682951

2952+
auto substitutions = ty->getContextSubstitutionMap();
2953+
29692954
CalleeInfo info(deinitTy,
29702955
deinitTy->substGenericArgs(IGF.getSILModule(),
29712956
substitutions,

0 commit comments

Comments
 (0)