@@ -1359,14 +1359,17 @@ struct GatherUsesVisitor final : public TransitiveAddressWalker {
1359
1359
1360
1360
// Pruned liveness used to validate that load [take]/load [copy] can be
1361
1361
// converted to load_borrow without violating exclusivity.
1362
- SSAPrunedLiveness & liveness;
1362
+ BitfieldRef< SSAPrunedLiveness> liveness;
1363
1363
1364
- GatherUsesVisitor (MoveOnlyAddressCheckerPImpl &moveChecker,
1365
- UseState &useState, MarkMustCheckInst *markedValue,
1366
- DiagnosticEmitter &diagnosticEmitter,
1367
- SSAPrunedLiveness &gatherUsesLiveness)
1364
+ SmallVectorImpl<SILBasicBlock *> &gatherUsesDiscoveredBlocks;
1365
+
1366
+ GatherUsesVisitor (
1367
+ MoveOnlyAddressCheckerPImpl &moveChecker, UseState &useState,
1368
+ MarkMustCheckInst *markedValue, DiagnosticEmitter &diagnosticEmitter,
1369
+ SmallVectorImpl<SILBasicBlock *> &gatherUsesDiscoveredBlocks)
1368
1370
: moveChecker(moveChecker), useState(useState), markedValue(markedValue),
1369
- diagnosticEmitter (diagnosticEmitter), liveness(gatherUsesLiveness) {}
1371
+ diagnosticEmitter (diagnosticEmitter),
1372
+ gatherUsesDiscoveredBlocks(gatherUsesDiscoveredBlocks) {}
1370
1373
1371
1374
bool visitUse (Operand *op) override ;
1372
1375
void reset (MarkMustCheckInst *address) { useState.address = address; }
@@ -1383,7 +1386,8 @@ struct GatherUsesVisitor final : public TransitiveAddressWalker {
1383
1386
1384
1387
// / Returns true if we emitted an error.
1385
1388
bool checkForExclusivityHazards (LoadInst *li) {
1386
- SWIFT_DEFER { liveness.invalidate (); };
1389
+ BitfieldRef<SSAPrunedLiveness>::StackState state (
1390
+ liveness, li->getFunction (), &gatherUsesDiscoveredBlocks);
1387
1391
1388
1392
LLVM_DEBUG (llvm::dbgs () << " Checking for exclusivity hazards for: " << *li);
1389
1393
@@ -1404,10 +1408,10 @@ struct GatherUsesVisitor final : public TransitiveAddressWalker {
1404
1408
}
1405
1409
1406
1410
bool emittedError = false ;
1407
- liveness. initializeDef (bai);
1408
- liveness. computeSimple ();
1411
+ liveness-> initializeDef (bai);
1412
+ liveness-> computeSimple ();
1409
1413
for (auto *consumingUse : li->getConsumingUses ()) {
1410
- if (!liveness. isWithinBoundary (consumingUse->getUser ())) {
1414
+ if (!liveness-> isWithinBoundary (consumingUse->getUser ())) {
1411
1415
diagnosticEmitter.emitAddressExclusivityHazardDiagnostic (
1412
1416
markedValue, consumingUse->getUser ());
1413
1417
emittedError = true ;
@@ -2416,9 +2420,8 @@ bool MoveOnlyAddressCheckerPImpl::performSingleCheck(
2416
2420
// to categorize the uses of this address into their ownership behavior (e.x.:
2417
2421
// init, reinit, take, destroy, etc.).
2418
2422
SmallVector<SILBasicBlock *, 32 > gatherUsesDiscoveredBlocks;
2419
- SSAPrunedLiveness gatherUsesLiveness (fn, &gatherUsesDiscoveredBlocks);
2420
2423
GatherUsesVisitor visitor (*this , addressUseState, markedAddress,
2421
- diagnosticEmitter, gatherUsesLiveness );
2424
+ diagnosticEmitter, gatherUsesDiscoveredBlocks );
2422
2425
SWIFT_DEFER { visitor.clear (); };
2423
2426
visitor.reset (markedAddress);
2424
2427
if (AddressUseKind::Unknown == std::move (visitor).walk (markedAddress)) {
0 commit comments