SIL: Use better type lowering APIs in a couple of spots

This commit is contained in:
Slava Pestov
2019-03-05 15:05:06 -05:00
parent bb97dbf243
commit 5847e163c1
12 changed files with 55 additions and 48 deletions

View File

@@ -705,7 +705,7 @@ SILInstruction *CastOptimizer::simplifyCheckedCastAddrBranchInst(
if (Feasibility == DynamicCastFeasibility::WillFail) {
if (shouldDestroyOnFailure(Inst->getConsumptionKind())) {
auto &srcTL = Builder.getModule().getTypeLowering(Src->getType());
auto &srcTL = Builder.getTypeLowering(Src->getType());
srcTL.emitDestroyAddress(Builder, Loc, Src);
}
auto NewI = Builder.createBranch(Loc, FailureBB);
@@ -748,7 +748,7 @@ SILInstruction *CastOptimizer::simplifyCheckedCastAddrBranchInst(
// is not used afterwards.
if (ResultNotUsed) {
if (shouldTakeOnSuccess(Inst->getConsumptionKind())) {
auto &srcTL = Builder.getModule().getTypeLowering(Src->getType());
auto &srcTL = Builder.getTypeLowering(Src->getType());
srcTL.emitDestroyAddress(Builder, Loc, Src);
}
EraseInstAction(Inst);