Skip to content

Commit d0571e6

Browse files
committed
[silgen] When forwarding an rvalue into memory to pass as an argument, make sure it is at plus 1.
This can only come up with the +1 runtime if we need to pass a +0 value into memory. As with the other ArgumentSource change, I don't think such code can be emitted today. It does happen often with the +0 runtime though. rdar://34222540
1 parent f6ec0f0 commit d0571e6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/SILGen/ArgumentSource.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ ManagedValue ArgumentSource::getAsSingleValue(SILGenFunction &SGF,
174174
case Kind::RValue: {
175175
auto loc = getKnownRValueLocation();
176176
if (auto init = C.getEmitInto()) {
177-
std::move(*this).asKnownRValue(SGF).forwardInto(SGF, loc, init);
177+
std::move(*this).asKnownRValue(SGF)
178+
.ensurePlusOne(SGF, loc)
179+
.forwardInto(SGF, loc, init);
178180
return ManagedValue::forInContext();
179181
} else {
180182
return std::move(*this).asKnownRValue(SGF).getAsSingleValue(SGF, loc);

0 commit comments

Comments
 (0)