@@ -99,14 +99,6 @@ class SILValueOwnershipChecker {
99
99
// / is successful.
100
100
SmallVector<Operand *, 16 > regularUsers;
101
101
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
-
110
102
// / The set of blocks that we have visited.
111
103
SmallPtrSetImpl<SILBasicBlock *> &visitedBlocks;
112
104
@@ -133,13 +125,10 @@ class SILValueOwnershipChecker {
133
125
bool isCompatibleDefUse (Operand *op, ValueOwnershipKind ownershipKind);
134
126
135
127
bool gatherUsers (SmallVectorImpl<Operand *> &lifetimeEndingUsers,
136
- SmallVectorImpl<Operand *> ®ularUsers,
137
- SmallVectorImpl<Operand *> &implicitRegularUsers);
128
+ SmallVectorImpl<Operand *> ®ularUsers);
138
129
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);
143
132
144
133
bool checkValueWithoutLifetimeEndingUses ();
145
134
@@ -169,7 +158,6 @@ bool SILValueOwnershipChecker::check() {
169
158
llvm::copy (lifetimeEndingUsers, std::back_inserter (allLifetimeEndingUsers));
170
159
SmallVector<Operand *, 32 > allRegularUsers;
171
160
llvm::copy (regularUsers, std::back_inserter (allRegularUsers));
172
- llvm::copy (implicitRegularUsers, std::back_inserter (allRegularUsers));
173
161
174
162
LinearLifetimeChecker checker (visitedBlocks, deadEndBlocks);
175
163
auto linearLifetimeResult = checker.checkValue (value, allLifetimeEndingUsers,
@@ -223,8 +211,7 @@ bool SILValueOwnershipChecker::isCompatibleDefUse(
223
211
224
212
bool SILValueOwnershipChecker::gatherNonGuaranteedUsers (
225
213
SmallVectorImpl<Operand *> &lifetimeEndingUsers,
226
- SmallVectorImpl<Operand *> &nonLifetimeEndingUsers,
227
- SmallVectorImpl<Operand *> &implicitRegularUsers) {
214
+ SmallVectorImpl<Operand *> &nonLifetimeEndingUsers) {
228
215
bool foundError = false ;
229
216
230
217
auto ownershipKind = value.getOwnershipKind ();
@@ -289,24 +276,23 @@ bool SILValueOwnershipChecker::gatherNonGuaranteedUsers(
289
276
});
290
277
};
291
278
foundError |=
292
- initialScopedOperand->getImplicitUses (implicitRegularUsers , &error);
279
+ initialScopedOperand->getImplicitUses (nonLifetimeEndingUsers , &error);
293
280
}
294
281
295
282
return foundError;
296
283
}
297
284
298
285
bool SILValueOwnershipChecker::gatherUsers (
299
286
SmallVectorImpl<Operand *> &lifetimeEndingUsers,
300
- SmallVectorImpl<Operand *> &nonLifetimeEndingUsers,
301
- SmallVectorImpl<Operand *> &implicitRegularUsers) {
287
+ SmallVectorImpl<Operand *> &nonLifetimeEndingUsers) {
302
288
303
289
// See if Value is guaranteed. If we are guaranteed and not forwarding, then
304
290
// we need to look through subobject uses for more uses. Otherwise, if we are
305
291
// forwarding, we do not create any lifetime ending users/non lifetime ending
306
292
// users since we verify against our base.
307
293
if (value.getOwnershipKind () != ValueOwnershipKind::Guaranteed) {
308
- return !gatherNonGuaranteedUsers (
309
- lifetimeEndingUsers, nonLifetimeEndingUsers, implicitRegularUsers );
294
+ return !gatherNonGuaranteedUsers (lifetimeEndingUsers,
295
+ nonLifetimeEndingUsers );
310
296
}
311
297
312
298
// Ok, we have a value with guarantee ownership. Before we continue, check if
@@ -387,7 +373,7 @@ bool SILValueOwnershipChecker::gatherUsers(
387
373
});
388
374
};
389
375
foundError |=
390
- scopedOperand->getImplicitUses (implicitRegularUsers , &onError);
376
+ scopedOperand->getImplicitUses (nonLifetimeEndingUsers , &onError);
391
377
}
392
378
393
379
// Next see if our use is an interior pointer operand. If we have an
@@ -404,7 +390,7 @@ bool SILValueOwnershipChecker::gatherUsers(
404
390
});
405
391
};
406
392
foundError |= interiorPointerOperand->getImplicitUses (
407
- implicitRegularUsers , &onError);
393
+ nonLifetimeEndingUsers , &onError);
408
394
}
409
395
410
396
// Finally add the op to the non lifetime ending user list.
@@ -621,7 +607,7 @@ bool SILValueOwnershipChecker::checkUses() {
621
607
// 1. Verify that none of the uses are in the same block. This would be an
622
608
// overconsume so in this case we assert.
623
609
// 2. Verify that the uses are compatible with our ownership convention.
624
- if (!gatherUsers (lifetimeEndingUsers, regularUsers, implicitRegularUsers )) {
610
+ if (!gatherUsers (lifetimeEndingUsers, regularUsers)) {
625
611
// Silently return false if this fails.
626
612
//
627
613
// If the user pass in a ErrorBehaviorKind that will assert, we
0 commit comments