@@ -122,14 +122,14 @@ void MoveOnlyChecker::checkObjects() {
122122
123123void MoveOnlyChecker::completeObjectLifetimes (
124124 ArrayRef<MarkUnresolvedNonCopyableValueInst *> insts) {
125- // TODO: Delete once OSSALifetimeCompletion is run as part of SILGenCleanup.
126- OSSALifetimeCompletion completion (fn, domTree, *deba->get (fn));
127-
128- // Collect all values derived from each mark_unresolved_non_copyable_value
129- // instruction via ownership instructions and phis.
130- ValueWorklist transitiveValues (fn);
131- for (auto *inst : insts) {
132- transitiveValues.push (inst);
125+ // TODO: Delete once OSSALifetimeCompletion is run as part of SILGenCleanup.
126+ OSSALifetimeCompletion completion (fn, domTree, *deba->get (fn));
127+
128+ // Collect all values derived from each mark_unresolved_non_copyable_value
129+ // instruction via ownership instructions and phis.
130+ ValueWorklist transitiveValues (fn);
131+ for (auto *inst : insts) {
132+ transitiveValues.push (inst);
133133 }
134134 while (auto value = transitiveValues.pop ()) {
135135 for (auto *use : value->getUses ()) {
@@ -163,6 +163,10 @@ for (auto *inst : insts) {
163163 for (auto *block : poa->get (fn)->getPostOrder ()) {
164164 for (SILInstruction &inst : reverse (*block)) {
165165 for (auto result : inst.getResults ()) {
166+ if (llvm::any_of (result->getUsers (),
167+ [](auto *user) { return isa<BranchInst>(user); })) {
168+ continue ;
169+ }
166170 if (!transitiveValues.isVisited (result))
167171 continue ;
168172 if (completion.completeOSSALifetime (
@@ -173,7 +177,9 @@ for (auto *inst : insts) {
173177 }
174178 }
175179 for (SILArgument *arg : block->getArguments ()) {
176- assert (!arg->isReborrow () && " reborrows not legal at this SIL stage" );
180+ if (arg->isReborrow ()) {
181+ continue ;
182+ }
177183 if (!transitiveValues.isVisited (arg))
178184 continue ;
179185 if (completion.completeOSSALifetime (
0 commit comments