mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILOptimizer: Pipe through TypeExpansionContext
This commit is contained in:
@@ -436,7 +436,8 @@ static bool rewriteAllocBoxAsAllocStack(AllocBoxInst *ABI) {
|
||||
&& "rewriting multi-field box not implemented");
|
||||
auto *ASI = Builder.createAllocStack(
|
||||
ABI->getLoc(),
|
||||
getSILBoxFieldType(ABI->getBoxType(), ABI->getModule().Types, 0),
|
||||
getSILBoxFieldType(TypeExpansionContext(*ABI->getFunction()),
|
||||
ABI->getBoxType(), ABI->getModule().Types, 0),
|
||||
ABI->getVarInfo(), ABI->hasDynamicLifetime());
|
||||
|
||||
// Transfer a mark_uninitialized if we have one.
|
||||
@@ -452,9 +453,9 @@ static bool rewriteAllocBoxAsAllocStack(AllocBoxInst *ABI) {
|
||||
|
||||
assert(ABI->getBoxType()->getLayout()->getFields().size() == 1
|
||||
&& "promoting multi-field box not implemented");
|
||||
auto &Lowering = ABI->getFunction()
|
||||
->getTypeLowering(
|
||||
getSILBoxFieldType(ABI->getBoxType(), ABI->getModule().Types, 0));
|
||||
auto &Lowering = ABI->getFunction()->getTypeLowering(
|
||||
getSILBoxFieldType(TypeExpansionContext(*ABI->getFunction()),
|
||||
ABI->getBoxType(), ABI->getModule().Types, 0));
|
||||
auto Loc = CleanupLocation::get(ABI->getLoc());
|
||||
|
||||
for (auto LastRelease : FinalReleases) {
|
||||
@@ -585,7 +586,7 @@ SILFunction *PromotedParamCloner::initCloned(SILOptFunctionBuilder &FuncBuilder,
|
||||
auto &TC = Orig->getModule().Types;
|
||||
Lowering::GenericContextScope scope(TC,
|
||||
OrigFTI->getSubstGenericSignature());
|
||||
paramTy = getSILBoxFieldType(boxTy, TC, 0);
|
||||
paramTy = getSILBoxFieldType(TypeExpansionContext(*Orig), boxTy, TC, 0);
|
||||
}
|
||||
auto promotedParam = SILParameterInfo(paramTy.getASTType(),
|
||||
ParameterConvention::Indirect_InoutAliasable);
|
||||
@@ -650,7 +651,8 @@ PromotedParamCloner::populateCloned() {
|
||||
auto boxTy = (*I)->getType().castTo<SILBoxType>();
|
||||
assert(boxTy->getLayout()->getFields().size() == 1
|
||||
&& "promoting multi-field boxes not implemented yet");
|
||||
auto promotedTy = getSILBoxFieldType(boxTy, Cloned->getModule().Types, 0);
|
||||
auto promotedTy = getSILBoxFieldType(TypeExpansionContext(*Cloned), boxTy,
|
||||
Cloned->getModule().Types, 0);
|
||||
auto *promotedArg =
|
||||
ClonedEntryBB->createFunctionArgument(promotedTy, (*I)->getDecl());
|
||||
OrigPromotedParameters.insert(*I);
|
||||
|
||||
Reference in New Issue
Block a user