Skip to content

Commit 2fd12d7

Browse files
committed
[move-only] Eliminate dead code that was not removed when re-projected move only types were removed.
1 parent 0628c26 commit 2fd12d7

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

lib/SILGen/SILGenLValue.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4528,28 +4528,6 @@ void SILGenFunction::emitSemanticStore(SILLocation loc,
45284528
rvalue = B.createOwnedMoveOnlyWrapperToCopyableValue(loc, rvalue);
45294529
}
45304530

4531-
// See if our rvalue is a box whose boxed type matches the destTL type. In
4532-
// that case, emit a project_box eagerly. This can happen for escaping
4533-
// captured move only arguments.
4534-
if (auto boxType = rvalue->getType().getAs<SILBoxType>()) {
4535-
auto fieldType = rvalue->getType().getSILBoxFieldType(&F, 0);
4536-
assert(fieldType.isMoveOnly());
4537-
if (fieldType.getObjectType() == destTL.getLoweredType()) {
4538-
SILValue box = rvalue;
4539-
rvalue = B.createProjectBox(loc, rvalue, 0);
4540-
// If we have a let, we rely on the typechecker to error if we attempt to
4541-
// assign to it.
4542-
bool isMutable = boxType->getLayout()->getFields()[0].isMutable();
4543-
if (isMutable)
4544-
rvalue = B.createMarkMustCheckInst(
4545-
loc, rvalue,
4546-
MarkMustCheckInst::CheckKind::AssignableButNotConsumable);
4547-
B.emitCopyAddrOperation(loc, rvalue, dest, IsNotTake, isInit);
4548-
B.emitDestroyValueOperation(loc, box);
4549-
return;
4550-
}
4551-
}
4552-
45534531
// Easy case: the types match.
45544532
if (rvalue->getType() == destTL.getLoweredType()) {
45554533
assert(!silConv.useLoweredAddresses()

0 commit comments

Comments
 (0)