File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1984,10 +1984,12 @@ simplifyCheckedCastAddrBranchInst(CheckedCastAddrBranchInst *Inst) {
1984
1984
// The unconditional_addr_cast can be skipped, if the result of a cast
1985
1985
// is not used afterwards.
1986
1986
if (ResultNotUsed) {
1987
+ if (shouldTakeOnSuccess (Inst->getConsumptionKind ())) {
1988
+ auto &srcTL = Builder.getModule ().getTypeLowering (Src->getType ());
1989
+ srcTL.emitDestroyAddress (Builder, Loc, Src);
1990
+ }
1987
1991
EraseInstAction (Inst);
1988
1992
Builder.setInsertionPoint (BB);
1989
- if (shouldTakeOnSuccess (Inst->getConsumptionKind ()))
1990
- Builder.emitDestroyAddr (Loc, Src);
1991
1993
auto *NewI = Builder.createBranch (Loc, SuccessBB);
1992
1994
WillSucceedAction ();
1993
1995
return NewI;
Original file line number Diff line number Diff line change @@ -2914,7 +2914,8 @@ class IsQ : Q {}
2914
2914
// CHECK-LABEL: sil @test_dead_checked_cast_br : $@convention(thin) (@in IsQ) -> () {
2915
2915
// CHECK: bb0(%0 : $*IsQ):
2916
2916
// CHECK: [[Q:%.*]] = alloc_stack $Q
2917
- // CHECK: destroy_addr %0 : $*IsQ
2917
+ // CHECK: [[LD:%.*]] = load %0 : $*IsQ
2918
+ // CHECK: strong_release [[LD]] : $IsQ
2918
2919
// CHECK: dealloc_stack [[Q]] : $*Q
2919
2920
// CHECK: [[R:%.*]] = tuple ()
2920
2921
// CHECK: return [[R]] : $()
You can’t perform that action at this time.
0 commit comments