@@ -99,14 +99,6 @@ class SILValueOwnershipChecker {
9999 // / is successful.
100100 SmallVector<Operand *, 16 > regularUsers;
101101
102- // / The list of implicit non lifetime ending users that we found. This
103- // / consists of instructions like end_borrow that end a scoped lifetime. We
104- // / must treat those as regular uses and ensure that our value is not
105- // / destroyed while that sub-scope is valid.
106- // /
107- // / TODO: Rename to SubBorrowScopeUsers?
108- SmallVector<Operand *, 4 > implicitRegularUsers;
109-
110102 // / The set of blocks that we have visited.
111103 SmallPtrSetImpl<SILBasicBlock *> &visitedBlocks;
112104
@@ -133,13 +125,10 @@ class SILValueOwnershipChecker {
133125 bool isCompatibleDefUse (Operand *op, ValueOwnershipKind ownershipKind);
134126
135127 bool gatherUsers (SmallVectorImpl<Operand *> &lifetimeEndingUsers,
136- SmallVectorImpl<Operand *> ®ularUsers,
137- SmallVectorImpl<Operand *> &implicitRegularUsers);
128+ SmallVectorImpl<Operand *> ®ularUsers);
138129
139- bool
140- gatherNonGuaranteedUsers (SmallVectorImpl<Operand *> &lifetimeEndingUsers,
141- SmallVectorImpl<Operand *> ®ularUsers,
142- SmallVectorImpl<Operand *> &implicitRegularUsers);
130+ bool gatherNonGuaranteedUsers (SmallVectorImpl<Operand *> &lifetimeEndingUsers,
131+ SmallVectorImpl<Operand *> ®ularUsers);
143132
144133 bool checkValueWithoutLifetimeEndingUses ();
145134
@@ -169,7 +158,6 @@ bool SILValueOwnershipChecker::check() {
169158 llvm::copy (lifetimeEndingUsers, std::back_inserter (allLifetimeEndingUsers));
170159 SmallVector<Operand *, 32 > allRegularUsers;
171160 llvm::copy (regularUsers, std::back_inserter (allRegularUsers));
172- llvm::copy (implicitRegularUsers, std::back_inserter (allRegularUsers));
173161
174162 LinearLifetimeChecker checker (visitedBlocks, deadEndBlocks);
175163 auto linearLifetimeResult = checker.checkValue (value, allLifetimeEndingUsers,
@@ -223,8 +211,7 @@ bool SILValueOwnershipChecker::isCompatibleDefUse(
223211
224212bool SILValueOwnershipChecker::gatherNonGuaranteedUsers (
225213 SmallVectorImpl<Operand *> &lifetimeEndingUsers,
226- SmallVectorImpl<Operand *> &nonLifetimeEndingUsers,
227- SmallVectorImpl<Operand *> &implicitRegularUsers) {
214+ SmallVectorImpl<Operand *> &nonLifetimeEndingUsers) {
228215 bool foundError = false ;
229216
230217 auto ownershipKind = value.getOwnershipKind ();
@@ -289,24 +276,23 @@ bool SILValueOwnershipChecker::gatherNonGuaranteedUsers(
289276 });
290277 };
291278 foundError |=
292- initialScopedOperand->getImplicitUses (implicitRegularUsers , &error);
279+ initialScopedOperand->getImplicitUses (nonLifetimeEndingUsers , &error);
293280 }
294281
295282 return foundError;
296283}
297284
298285bool SILValueOwnershipChecker::gatherUsers (
299286 SmallVectorImpl<Operand *> &lifetimeEndingUsers,
300- SmallVectorImpl<Operand *> &nonLifetimeEndingUsers,
301- SmallVectorImpl<Operand *> &implicitRegularUsers) {
287+ SmallVectorImpl<Operand *> &nonLifetimeEndingUsers) {
302288
303289 // See if Value is guaranteed. If we are guaranteed and not forwarding, then
304290 // we need to look through subobject uses for more uses. Otherwise, if we are
305291 // forwarding, we do not create any lifetime ending users/non lifetime ending
306292 // users since we verify against our base.
307293 if (value.getOwnershipKind () != ValueOwnershipKind::Guaranteed) {
308- return !gatherNonGuaranteedUsers (
309- lifetimeEndingUsers, nonLifetimeEndingUsers, implicitRegularUsers );
294+ return !gatherNonGuaranteedUsers (lifetimeEndingUsers,
295+ nonLifetimeEndingUsers );
310296 }
311297
312298 // Ok, we have a value with guarantee ownership. Before we continue, check if
@@ -387,7 +373,7 @@ bool SILValueOwnershipChecker::gatherUsers(
387373 });
388374 };
389375 foundError |=
390- scopedOperand->getImplicitUses (implicitRegularUsers , &onError);
376+ scopedOperand->getImplicitUses (nonLifetimeEndingUsers , &onError);
391377 }
392378
393379 // Next see if our use is an interior pointer operand. If we have an
@@ -404,7 +390,7 @@ bool SILValueOwnershipChecker::gatherUsers(
404390 });
405391 };
406392 foundError |= interiorPointerOperand->getImplicitUses (
407- implicitRegularUsers , &onError);
393+ nonLifetimeEndingUsers , &onError);
408394 }
409395
410396 // Finally add the op to the non lifetime ending user list.
@@ -621,7 +607,7 @@ bool SILValueOwnershipChecker::checkUses() {
621607 // 1. Verify that none of the uses are in the same block. This would be an
622608 // overconsume so in this case we assert.
623609 // 2. Verify that the uses are compatible with our ownership convention.
624- if (!gatherUsers (lifetimeEndingUsers, regularUsers, implicitRegularUsers )) {
610+ if (!gatherUsers (lifetimeEndingUsers, regularUsers)) {
625611 // Silently return false if this fails.
626612 //
627613 // If the user pass in a ErrorBehaviorKind that will assert, we
0 commit comments