@@ -122,14 +122,14 @@ void MoveOnlyChecker::checkObjects() {
122
122
123
123
void MoveOnlyChecker::completeObjectLifetimes (
124
124
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);
133
133
}
134
134
while (auto value = transitiveValues.pop ()) {
135
135
for (auto *use : value->getUses ()) {
@@ -163,6 +163,10 @@ for (auto *inst : insts) {
163
163
for (auto *block : poa->get (fn)->getPostOrder ()) {
164
164
for (SILInstruction &inst : reverse (*block)) {
165
165
for (auto result : inst.getResults ()) {
166
+ if (llvm::any_of (result->getUsers (),
167
+ [](auto *user) { return isa<BranchInst>(user); })) {
168
+ continue ;
169
+ }
166
170
if (!transitiveValues.isVisited (result))
167
171
continue ;
168
172
if (completion.completeOSSALifetime (
@@ -173,7 +177,9 @@ for (auto *inst : insts) {
173
177
}
174
178
}
175
179
for (SILArgument *arg : block->getArguments ()) {
176
- assert (!arg->isReborrow () && " reborrows not legal at this SIL stage" );
180
+ if (arg->isReborrow ()) {
181
+ continue ;
182
+ }
177
183
if (!transitiveValues.isVisited (arg))
178
184
continue ;
179
185
if (completion.completeOSSALifetime (
0 commit comments