Skip to content

Commit e973642

Browse files
committed
[silgen] Delete dead code.
We only use the other emitCheckedCastBranchOld so this is dead. rdar://29791263
1 parent 42785be commit e973642

File tree

2 files changed

+0
-53
lines changed

2 files changed

+0
-53
lines changed

lib/SILGen/SILGenDynamicCast.cpp

-39
Original file line numberDiff line numberDiff line change
@@ -328,34 +328,6 @@ namespace {
328328

329329
bool isOperandIndirect() const { return Strategy == CastStrategy::Address; }
330330

331-
ManagedValue emitOperand(Expr *operand) {
332-
AbstractionPattern mostGeneral =
333-
SGF.SGM.Types.getMostGeneralAbstraction();
334-
auto &origSourceTL = SGF.getTypeLowering(mostGeneral, SourceType);
335-
336-
SGFContext ctx;
337-
338-
std::unique_ptr<TemporaryInitialization> temporary;
339-
if (isOperandIndirect() && SGF.silConv.useLoweredAddresses()) {
340-
temporary = SGF.emitTemporary(Loc, origSourceTL);
341-
ctx = SGFContext(temporary.get());
342-
}
343-
344-
auto result =
345-
SGF.emitRValueAsOrig(operand, mostGeneral, origSourceTL, ctx);
346-
347-
if (isOperandIndirect() && SGF.silConv.useLoweredAddresses()) {
348-
// Force the result into the temporary if it's not already there.
349-
if (!result.isInContext()) {
350-
result.forwardInto(SGF, Loc, temporary->getAddress());
351-
temporary->finishInitialization(SGF);
352-
}
353-
return temporary->getManagedAddress();
354-
}
355-
356-
return result;
357-
}
358-
359331
RValue emitUnconditionalCast(ManagedValue operand, SGFContext ctx) {
360332
// The cast functions don't know how to work with anything but
361333
// the most general possible abstraction level.
@@ -542,17 +514,6 @@ namespace {
542514
};
543515
} // end anonymous namespace
544516

545-
void SILGenFunction::emitCheckedCastBranchOld(
546-
SILLocation loc, Expr *source, Type targetType, SGFContext ctx,
547-
llvm::function_ref<void(ManagedValue)> handleTrue,
548-
llvm::function_ref<void()> handleFalse, ProfileCounter TrueCount,
549-
ProfileCounter FalseCount) {
550-
CheckedCastEmitterOld emitter(*this, loc, source->getType(), targetType);
551-
ManagedValue operand = emitter.emitOperand(source);
552-
emitter.emitConditional(operand, CastConsumptionKind::TakeAlways, ctx,
553-
handleTrue, handleFalse, TrueCount, FalseCount);
554-
}
555-
556517
void SILGenFunction::emitCheckedCastBranchOld(
557518
SILLocation loc, ConsumableManagedValue src, Type sourceType,
558519
CanType targetType, SGFContext ctx,

lib/SILGen/SILGenFunction.h

-14
Original file line numberDiff line numberDiff line change
@@ -1486,20 +1486,6 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction
14861486
ProfileCounter TrueCount = ProfileCounter(),
14871487
ProfileCounter FalseCount = ProfileCounter());
14881488

1489-
/// A form of checked cast branch that uses the old non-ownership preserving
1490-
/// semantics.
1491-
///
1492-
/// The main difference is that this code does not pass the old argument as a
1493-
/// block argument in the failure case. This causes values to be double
1494-
/// consumed.
1495-
void
1496-
emitCheckedCastBranchOld(SILLocation loc, Expr *source, Type targetType,
1497-
SGFContext ctx,
1498-
llvm::function_ref<void(ManagedValue)> handleTrue,
1499-
llvm::function_ref<void()> handleFalse,
1500-
ProfileCounter TrueCount = ProfileCounter(),
1501-
ProfileCounter FalseCount = ProfileCounter());
1502-
15031489
/// \brief Emit a conditional checked cast branch, starting from an
15041490
/// expression. Terminates the current BB.
15051491
///

0 commit comments

Comments
 (0)