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(
14381438void swift::visitTransitiveEndBorrows (
14391439 BorrowedValue beginBorrow,
14401440 function_ref<void (EndBorrowInst *)> visitEndBorrow) {
1441- SmallSetVector <SILValue, 4 > worklist;
1441+ DAGNodeWorklist <SILValue, 4 > worklist;
14421442 worklist.insert (beginBorrow.value );
14431443
14441444 while (!worklist.empty ()) {
1445- auto val = worklist.pop_back_val ();
1445+ auto val = worklist.pop ();
14461446 for (auto *consumingUse : val->getConsumingUses ()) {
14471447 auto *consumingUser = consumingUse->getUser ();
14481448 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):
652652 return %res : $()
653653}
654654
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