Skip to content

Commit b3e9a7f

Browse files
Merge pull request #34324 from aschwaighofer/fix_opaque_indirect_return_results_loadable_by_address
LoadableByAddress: Make sure that indirect return arguments are at the right type expansion
2 parents dd62ccd + 18777bf commit b3e9a7f

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

lib/IRGen/LoadableByAddress.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,8 @@ void LoadableStorageAllocation::insertIndirectReturnArgs() {
14071407
canType = genEnv->mapTypeIntoContext(canType)->getCanonicalType();
14081408
}
14091409
resultStorageType = SILType::getPrimitiveObjectType(canType);
1410-
auto newResultStorageType = pass.getNewSILType(loweredTy, resultStorageType);
1410+
auto newResultStorageType =
1411+
pass.F->getLoweredType(pass.getNewSILType(loweredTy, resultStorageType));
14111412

14121413
auto &ctx = pass.F->getModule().getASTContext();
14131414
auto var = new (ctx) ParamDecl(

test/IRGen/big_types_generic.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,29 @@ func useStuff() {
6767
print(generic2(1).0)
6868
print(generic2(1).1)
6969
}
70+
71+
72+
public struct BigThing<T> {
73+
var x: (Int64, Int64, Int64, Int64) = (0, 0, 0, 0)
74+
var y: (Int64, Int64, Int64, Int64) = (0, 0, 0, 0)
75+
var z: (Int64, Int64, Int64, Int64) = (0, 0, 0, 0)
76+
}
77+
78+
public protocol P {}
79+
80+
public protocol Assoc {
81+
associatedtype A
82+
func foo() -> A
83+
}
84+
85+
extension Int : P {}
86+
87+
public struct DefineSome : Assoc {
88+
public func foo() -> some P {
89+
return 5
90+
}
91+
}
92+
93+
public func abiIndirect() -> BigThing<DefineSome.A> {
94+
return BigThing<DefineSome.A>()
95+
}

0 commit comments

Comments
 (0)