File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -1438,11 +1438,11 @@ void swift::findTransitiveReborrowBaseValuePairs(
1438
1438
void swift::visitTransitiveEndBorrows (
1439
1439
BorrowedValue beginBorrow,
1440
1440
function_ref<void (EndBorrowInst *)> visitEndBorrow) {
1441
- SmallSetVector <SILValue, 4 > worklist;
1441
+ DAGNodeWorklist <SILValue, 4 > worklist;
1442
1442
worklist.insert (beginBorrow.value );
1443
1443
1444
1444
while (!worklist.empty ()) {
1445
- auto val = worklist.pop_back_val ();
1445
+ auto val = worklist.pop ();
1446
1446
for (auto *consumingUse : val->getConsumingUses ()) {
1447
1447
auto *consumingUser = consumingUse->getUser ();
1448
1448
if (auto *branch = dyn_cast<BranchInst>(consumingUser)) {
Original file line number Diff line number Diff line change @@ -652,3 +652,30 @@ bb4(%3 : @owned $Klass):
652
652
return %res : $()
653
653
}
654
654
655
+ // CHECK-LABEL: sil [ossa] @looping_borrow : $@convention(thin) () -> () {
656
+ // CHECK-NOT: destroy_value
657
+ // CHECK-LABEL: } // end sil function 'looping_borrow'
658
+ sil [ossa] @looping_borrow : $@convention(thin) () -> () {
659
+ entry:
660
+ %instance_1 = enum $FakeOptional<Klass>, #FakeOptional.none!enumelt
661
+ %lifetime_1 = begin_borrow [lexical] %instance_1 : $FakeOptional<Klass>
662
+ br loop_entry(%instance_1 : $FakeOptional<Klass>, %lifetime_1 : $FakeOptional<Klass>)
663
+
664
+ loop_entry(%18 : @owned $FakeOptional<Klass>, %19 : @guaranteed $FakeOptional<Klass>):
665
+ br loop_body
666
+
667
+ loop_body:
668
+ cond_br undef, loop_back, loop_exit
669
+
670
+ loop_back:
671
+ br loop_entry(%18 : $FakeOptional<Klass>, %19 : $FakeOptional<Klass>)
672
+
673
+ loop_exit:
674
+ end_borrow %19 : $FakeOptional<Klass>
675
+ destroy_value %18 : $FakeOptional<Klass>
676
+ br exit
677
+
678
+ exit:
679
+ %retval = tuple ()
680
+ return %retval : $()
681
+ }
You can’t perform that action at this time.
0 commit comments