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);
|
SILFunctionType::Representation::Thin);
|
||||||
SILFunction *NewF = OrigF->getModule().createFunction(
|
SILFunction *NewF = OrigF->getModule().createFunction(
|
||||||
SILLinkage::Shared, Name, NewFTy,
|
SILLinkage::Shared, Name, NewFTy,
|
||||||
/*contextGenericParams*/ nullptr, OrigF->getLocation(), OrigF->isBare(),
|
OrigF->getGenericEnvironment(), OrigF->getLocation(), OrigF->isBare(),
|
||||||
OrigF->isTransparent(), Fragile, OrigF->isThunk(),
|
OrigF->isTransparent(), Fragile, OrigF->isThunk(),
|
||||||
OrigF->getClassVisibility(), OrigF->getInlineStrategy(),
|
OrigF->getClassVisibility(), OrigF->getInlineStrategy(),
|
||||||
OrigF->getEffectsKind(),
|
OrigF->getEffectsKind(),
|
||||||
|
|||||||
@@ -240,7 +240,8 @@ static SILFunction *genGetterFromInit(StoreInst *Store,
|
|||||||
auto LoweredType = SILFunctionType::get(nullptr, EInfo,
|
auto LoweredType = SILFunctionType::get(nullptr, EInfo,
|
||||||
ParameterConvention::Direct_Owned, { }, Results, None,
|
ParameterConvention::Direct_Owned, { }, Results, None,
|
||||||
Store->getModule().getASTContext());
|
Store->getModule().getASTContext());
|
||||||
auto *GetterF = Store->getModule().getOrCreateFunction(Store->getLoc(),
|
auto *GetterF = Store->getModule().getOrCreateFunction(
|
||||||
|
Store->getLoc(),
|
||||||
getterName, SILLinkage::Private, LoweredType,
|
getterName, SILLinkage::Private, LoweredType,
|
||||||
IsBare_t::IsBare, IsTransparent_t::IsNotTransparent,
|
IsBare_t::IsBare, IsTransparent_t::IsNotTransparent,
|
||||||
IsFragile_t::IsFragile);
|
IsFragile_t::IsFragile);
|
||||||
@@ -493,8 +494,9 @@ static SILFunction *genGetterFromInit(SILFunction *InitF, VarDecl *varDecl) {
|
|||||||
auto LoweredType = SILFunctionType::get(nullptr, EInfo,
|
auto LoweredType = SILFunctionType::get(nullptr, EInfo,
|
||||||
ParameterConvention::Direct_Owned, { }, Results, None,
|
ParameterConvention::Direct_Owned, { }, Results, None,
|
||||||
InitF->getASTContext());
|
InitF->getASTContext());
|
||||||
auto *GetterF = InitF->getModule().getOrCreateFunction(InitF->getLocation(),
|
auto *GetterF = InitF->getModule().getOrCreateFunction(
|
||||||
getterName, SILLinkage::Private, LoweredType,
|
InitF->getLocation(),
|
||||||
|
getterName, SILLinkage::Private, LoweredType,
|
||||||
IsBare_t::IsBare, IsTransparent_t::IsNotTransparent,
|
IsBare_t::IsBare, IsTransparent_t::IsNotTransparent,
|
||||||
IsFragile_t::IsFragile);
|
IsFragile_t::IsFragile);
|
||||||
if (InitF->hasUnqualifiedOwnership())
|
if (InitF->hasUnqualifiedOwnership())
|
||||||
|
|||||||
@@ -488,10 +488,11 @@ void FunctionSignatureTransform::createFunctionSignatureOptimizedFunction() {
|
|||||||
DEBUG(llvm::dbgs() << " -> create specialized function " << Name << "\n");
|
DEBUG(llvm::dbgs() << " -> create specialized function " << Name << "\n");
|
||||||
|
|
||||||
NewF = M.createFunction(linkage, Name, createOptimizedSILFunctionType(),
|
NewF = M.createFunction(linkage, Name, createOptimizedSILFunctionType(),
|
||||||
nullptr, F->getLocation(), F->isBare(),
|
F->getGenericEnvironment(), F->getLocation(),
|
||||||
F->isTransparent(), F->isFragile(), F->isThunk(),
|
F->isBare(), F->isTransparent(), F->isFragile(),
|
||||||
F->getClassVisibility(), F->getInlineStrategy(),
|
F->isThunk(), F->getClassVisibility(),
|
||||||
F->getEffectsKind(), nullptr, F->getDebugScope());
|
F->getInlineStrategy(), F->getEffectsKind(), nullptr,
|
||||||
|
F->getDebugScope());
|
||||||
if (F->hasUnqualifiedOwnership()) {
|
if (F->hasUnqualifiedOwnership()) {
|
||||||
NewF->setUnqualifiedOwnership();
|
NewF->setUnqualifiedOwnership();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user