Skip to content

Commit b0a9833

Browse files
slavapestovjckarter
authored andcommitted
SILGen: emitUndef() doesn't have to enter a cleanup
We don't have to release undefined values...
1 parent 67f7e77 commit b0a9833

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/SILGen/SILGenExpr.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3517,16 +3517,11 @@ ManagedValue SILGenFunction::emitRValueAsSingleValue(Expr *E, SGFContext C) {
35173517
return std::move(rv).getAsSingleValue(*this, E);
35183518
}
35193519

3520-
static ManagedValue emitUndef(SILGenFunction &gen, SILLocation loc,
3521-
const TypeLowering &undefTL) {
3522-
SILValue undef = SILUndef::get(undefTL.getLoweredType(), gen.SGM.M);
3523-
return gen.emitManagedRValueWithCleanup(undef, undefTL);
3524-
}
3525-
35263520
ManagedValue SILGenFunction::emitUndef(SILLocation loc, Type type) {
3527-
return ::emitUndef(*this, loc, getTypeLowering(type));
3521+
return emitUndef(loc, getLoweredType(type));
35283522
}
35293523

35303524
ManagedValue SILGenFunction::emitUndef(SILLocation loc, SILType type) {
3531-
return ::emitUndef(*this, loc, getTypeLowering(type));
3525+
SILValue undef = SILUndef::get(type, SGM.M);
3526+
return ManagedValue::forUnmanaged(undef);
35323527
}

0 commit comments

Comments
 (0)