mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILOptimizer: Always create SILFunctions with a generic environment
This commit is contained in:
@@ -248,7 +248,7 @@ SILFunction *CapturePropagation::specializeConstClosure(PartialApplyInst *PAI,
|
||||
SILFunctionType::Representation::Thin);
|
||||
SILFunction *NewF = OrigF->getModule().createFunction(
|
||||
SILLinkage::Shared, Name, NewFTy,
|
||||
/*contextGenericParams*/ nullptr, OrigF->getLocation(), OrigF->isBare(),
|
||||
OrigF->getGenericEnvironment(), OrigF->getLocation(), OrigF->isBare(),
|
||||
OrigF->isTransparent(), Fragile, OrigF->isThunk(),
|
||||
OrigF->getClassVisibility(), OrigF->getInlineStrategy(),
|
||||
OrigF->getEffectsKind(),
|
||||
|
||||
@@ -240,7 +240,8 @@ static SILFunction *genGetterFromInit(StoreInst *Store,
|
||||
auto LoweredType = SILFunctionType::get(nullptr, EInfo,
|
||||
ParameterConvention::Direct_Owned, { }, Results, None,
|
||||
Store->getModule().getASTContext());
|
||||
auto *GetterF = Store->getModule().getOrCreateFunction(Store->getLoc(),
|
||||
auto *GetterF = Store->getModule().getOrCreateFunction(
|
||||
Store->getLoc(),
|
||||
getterName, SILLinkage::Private, LoweredType,
|
||||
IsBare_t::IsBare, IsTransparent_t::IsNotTransparent,
|
||||
IsFragile_t::IsFragile);
|
||||
@@ -493,8 +494,9 @@ static SILFunction *genGetterFromInit(SILFunction *InitF, VarDecl *varDecl) {
|
||||
auto LoweredType = SILFunctionType::get(nullptr, EInfo,
|
||||
ParameterConvention::Direct_Owned, { }, Results, None,
|
||||
InitF->getASTContext());
|
||||
auto *GetterF = InitF->getModule().getOrCreateFunction(InitF->getLocation(),
|
||||
getterName, SILLinkage::Private, LoweredType,
|
||||
auto *GetterF = InitF->getModule().getOrCreateFunction(
|
||||
InitF->getLocation(),
|
||||
getterName, SILLinkage::Private, LoweredType,
|
||||
IsBare_t::IsBare, IsTransparent_t::IsNotTransparent,
|
||||
IsFragile_t::IsFragile);
|
||||
if (InitF->hasUnqualifiedOwnership())
|
||||
|
||||
@@ -488,10 +488,11 @@ void FunctionSignatureTransform::createFunctionSignatureOptimizedFunction() {
|
||||
DEBUG(llvm::dbgs() << " -> create specialized function " << Name << "\n");
|
||||
|
||||
NewF = M.createFunction(linkage, Name, createOptimizedSILFunctionType(),
|
||||
nullptr, F->getLocation(), F->isBare(),
|
||||
F->isTransparent(), F->isFragile(), F->isThunk(),
|
||||
F->getClassVisibility(), F->getInlineStrategy(),
|
||||
F->getEffectsKind(), nullptr, F->getDebugScope());
|
||||
F->getGenericEnvironment(), F->getLocation(),
|
||||
F->isBare(), F->isTransparent(), F->isFragile(),
|
||||
F->isThunk(), F->getClassVisibility(),
|
||||
F->getInlineStrategy(), F->getEffectsKind(), nullptr,
|
||||
F->getDebugScope());
|
||||
if (F->hasUnqualifiedOwnership()) {
|
||||
NewF->setUnqualifiedOwnership();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user