@@ -66,7 +66,7 @@ class DiagnoseLifetimeIssues {
66
66
SILFunction *function = nullptr ;
67
67
68
68
// / The liveness of the object in question, computed in visitUses.
69
- SSAPrunedLiveness liveness;
69
+ BitfieldRef< SSAPrunedLiveness> liveness;
70
70
71
71
// / All weak stores of the object, which are found in visitUses.
72
72
llvm::SmallVector<SILInstruction *, 8 > weakStores;
@@ -86,8 +86,7 @@ class DiagnoseLifetimeIssues {
86
86
void reportDeadStore (SILInstruction *allocationInst);
87
87
88
88
public:
89
- DiagnoseLifetimeIssues (SILFunction *function)
90
- : function(function), liveness(function) {}
89
+ DiagnoseLifetimeIssues (SILFunction *function) : function(function) {}
91
90
92
91
void diagnose ();
93
92
};
@@ -215,7 +214,7 @@ visitUses(SILValue def, bool updateLivenessAndWeakStores, int callDepth) {
215
214
case OperandOwnership::UnownedInstantaneousUse:
216
215
case OperandOwnership::BitwiseEscape:
217
216
if (updateLivenessAndWeakStores)
218
- liveness. updateForUse (user, /* lifetimeEnding*/ false );
217
+ liveness-> updateForUse (user, /* lifetimeEnding*/ false );
219
218
break ;
220
219
case OperandOwnership::GuaranteedForwarding:
221
220
case OperandOwnership::ForwardingConsume:
@@ -241,9 +240,9 @@ visitUses(SILValue def, bool updateLivenessAndWeakStores, int callDepth) {
241
240
return CanEscape;
242
241
break ;
243
242
case OperandOwnership::Borrow: {
244
- if (updateLivenessAndWeakStores
245
- && (liveness. updateForBorrowingOperand (use)
246
- != InnerBorrowKind::Contained)) {
243
+ if (updateLivenessAndWeakStores &&
244
+ (liveness-> updateForBorrowingOperand (use) !=
245
+ InnerBorrowKind::Contained)) {
247
246
return CanEscape;
248
247
}
249
248
BorrowingOperand borrowOper (use);
@@ -326,11 +325,12 @@ static bool isOutOfLifetime(SILInstruction *inst, SSAPrunedLiveness &liveness) {
326
325
// / Reports a warning if the stored object \p storedObj is never loaded within
327
326
// / the lifetime of the stored object.
328
327
void DiagnoseLifetimeIssues::reportDeadStore (SILInstruction *allocationInst) {
329
- liveness.invalidate ();
328
+ BitfieldRef<SSAPrunedLiveness>::StackState livenessBitfieldContainer (
329
+ liveness, allocationInst->getFunction ());
330
330
weakStores.clear ();
331
331
332
332
SILValue storedDef = cast<SingleValueInstruction>(allocationInst);
333
- liveness. initializeDef (storedDef);
333
+ liveness-> initializeDef (storedDef);
334
334
335
335
// Compute the canonical lifetime of storedDef, like the copy-propagation pass
336
336
// would do.
@@ -346,7 +346,7 @@ void DiagnoseLifetimeIssues::reportDeadStore(SILInstruction *allocationInst) {
346
346
assert ((state == IsStoredWeakly) == !weakStores.empty ());
347
347
348
348
for (SILInstruction *storeInst : weakStores) {
349
- if (isOutOfLifetime (storeInst, liveness)) {
349
+ if (isOutOfLifetime (storeInst, * liveness)) {
350
350
// Issue the warning.
351
351
storeInst->getModule ().getASTContext ().Diags .diagnose (
352
352
storeInst->getLoc ().getSourceLoc (), diag::warn_dead_weak_store);
0 commit comments