@@ -156,7 +156,7 @@ getNewResults(GenericEnvironment *GenericEnv,
156
156
ArrayRef<SILResultInfo> origResults, irgen::IRGenModule &Mod) {
157
157
// Get new SIL Function results - same as old results UNLESS:
158
158
// 1) Function type results might have a different signature
159
- // 2) Large loadables are replaced by empty tuples
159
+ // 2) Large loadables are replaced by @out version
160
160
SmallVector<SILResultInfo, 2 > newResults;
161
161
for (auto result : origResults) {
162
162
SILType currResultTy = result.getSILStorageType ();
@@ -170,10 +170,8 @@ getNewResults(GenericEnvironment *GenericEnv,
170
170
newResults.push_back (newResult);
171
171
} else if (newSILType != currResultTy) {
172
172
// Case (2) Above
173
- auto emptyTy = Mod.getSILModule ().Types .getLoweredType (
174
- TupleType::getEmpty (Mod.getSILModule ().getASTContext ()));
175
- SILResultInfo newSILResultInfo (emptyTy.getSwiftRValueType (),
176
- ResultConvention::Unowned);
173
+ SILResultInfo newSILResultInfo (newSILType.getSwiftRValueType (),
174
+ ResultConvention::Indirect);
177
175
newResults.push_back (newSILResultInfo);
178
176
} else {
179
177
newResults.push_back (result);
@@ -290,17 +288,6 @@ getNewArgTys(GenericEnvironment *GenericEnv,
290
288
SILFunctionType *currSILFunctionType, irgen::IRGenModule &Mod) {
291
289
ArrayRef<SILParameterInfo> params = currSILFunctionType->getParameters ();
292
290
SmallVector<SILParameterInfo, 4 > newArgTys;
293
- auto canFuncType = CanSILFunctionType (currSILFunctionType);
294
- if (modResultType (GenericEnv, canFuncType, Mod)) {
295
- // Make a new param
296
- auto singleResult = canFuncType->getSingleResult ();
297
- auto resultStorageType = singleResult.getSILStorageType ();
298
- assert (resultStorageType.isObject () && " Expected an Object return Type" );
299
- auto newType = resultStorageType.getAddressType ();
300
- auto newParam = SILParameterInfo (newType.getSwiftRValueType (),
301
- ParameterConvention::Indirect_Inout);
302
- newArgTys.push_back (newParam);
303
- }
304
291
for (SILParameterInfo param : params) {
305
292
SILType storageType = param.getSILStorageType ();
306
293
SILType newOptFuncType =
@@ -2016,9 +2003,9 @@ void LoadableByAddress::recreateSingleApply(SILInstruction *applyInst) {
2016
2003
}
2017
2004
}
2018
2005
SILFunctionType *origSILFunctionType = applySite.getSubstCalleeType ();
2006
+ auto origCanType = CanSILFunctionType (origSILFunctionType);
2019
2007
Lowering::GenericContextScope GenericScope (
2020
- getModule ()->Types ,
2021
- CanSILFunctionType (origSILFunctionType)->getGenericSignature ());
2008
+ getModule ()->Types , origCanType->getGenericSignature ());
2022
2009
GenericEnvironment *genEnv = nullptr ;
2023
2010
if (origSILFunctionType->isPolymorphic ()) {
2024
2011
genEnv = getGenericEnvironment (applyInst->getModule (),
@@ -2035,8 +2022,7 @@ void LoadableByAddress::recreateSingleApply(SILInstruction *applyInst) {
2035
2022
// If we turned a direct result into an indirect parameter
2036
2023
// Find the new alloc we created earlier.
2037
2024
// and pass it as first parameter:
2038
- if (origSILFunctionType->getParameters ().size () !=
2039
- newSILFunctionType->getParameters ().size ()) {
2025
+ if (modResultType (genEnv, origCanType, *currIRMod)) {
2040
2026
assert (allApplyRetToAllocMap.find (applyInst) !=
2041
2027
allApplyRetToAllocMap.end ());
2042
2028
auto newAlloc = allApplyRetToAllocMap[applyInst];
0 commit comments