[silgen] Go through and fix up places where during bringup of load_borrow I just put in load_borrow without any end_borrow cleanups. Now use real cleanups.

rdar://29791263
This commit is contained in:
Michael Gottesman
2017-01-31 00:56:37 -08:00
parent 335a6c3bec
commit 80e297d6aa
7 changed files with 84 additions and 27 deletions

View File

@@ -1792,8 +1792,11 @@ emitEnumElementDispatch(ArrayRef<RowToSpecialize> rows,
if (elt->isIndirect() || elt->getParentEnum()->isIndirect()) {
SILValue boxedValue = SGF.B.createProjectBox(loc, origCMV.getValue(), 0);
eltTL = &SGF.getTypeLowering(boxedValue->getType());
if (eltTL->isLoadable())
boxedValue = SGF.B.createLoadBorrow(loc, boxedValue);
if (eltTL->isLoadable()) {
ManagedValue newLoadedBoxValue = SGF.B.createLoadBorrow(
loc, ManagedValue::forUnmanaged(boxedValue));
boxedValue = newLoadedBoxValue.getUnmanagedValue();
}
// The boxed value may be shared, so we always have to copy it.
eltCMV = getManagedSubobject(SGF, boxedValue, *eltTL,