@@ -1374,16 +1374,19 @@ struct GatherUsesVisitor : public AccessUseVisitor {
1374
1374
1375
1375
// Pruned liveness used to validate that load [take]/load [copy] can be
1376
1376
// converted to load_borrow without violating exclusivity.
1377
- SSAPrunedLiveness & liveness;
1377
+ BitfieldRef< SSAPrunedLiveness> liveness;
1378
1378
1379
- GatherUsesVisitor (MoveOnlyAddressCheckerPImpl &moveChecker,
1380
- UseState &useState, MarkMustCheckInst *markedValue,
1381
- DiagnosticEmitter &diagnosticEmitter,
1382
- SSAPrunedLiveness &gatherUsesLiveness)
1379
+ SmallVectorImpl<SILBasicBlock *> &gatherUsesDiscoveredBlocks;
1380
+
1381
+ GatherUsesVisitor (
1382
+ MoveOnlyAddressCheckerPImpl &moveChecker, UseState &useState,
1383
+ MarkMustCheckInst *markedValue, DiagnosticEmitter &diagnosticEmitter,
1384
+ SmallVectorImpl<SILBasicBlock *> &gatherUsesDiscoveredBlocks)
1383
1385
: AccessUseVisitor(AccessUseType::Inner,
1384
1386
NestedAccessType::IgnoreAccessBegin),
1385
1387
moveChecker (moveChecker), useState(useState), markedValue(markedValue),
1386
- diagnosticEmitter(diagnosticEmitter), liveness(gatherUsesLiveness) {}
1388
+ diagnosticEmitter(diagnosticEmitter),
1389
+ gatherUsesDiscoveredBlocks(gatherUsesDiscoveredBlocks) {}
1387
1390
1388
1391
bool visitUse (Operand *op, AccessUseType useTy) override ;
1389
1392
void reset (MarkMustCheckInst *address) { useState.address = address; }
@@ -1400,7 +1403,8 @@ struct GatherUsesVisitor : public AccessUseVisitor {
1400
1403
1401
1404
// / Returns true if we emitted an error.
1402
1405
bool checkForExclusivityHazards (LoadInst *li) {
1403
- SWIFT_DEFER { liveness.invalidate (); };
1406
+ BitfieldRef<SSAPrunedLiveness>::StackState state (
1407
+ liveness, li->getFunction (), &gatherUsesDiscoveredBlocks);
1404
1408
1405
1409
LLVM_DEBUG (llvm::dbgs () << " Checking for exclusivity hazards for: " << *li);
1406
1410
@@ -1421,10 +1425,10 @@ struct GatherUsesVisitor : public AccessUseVisitor {
1421
1425
}
1422
1426
1423
1427
bool emittedError = false ;
1424
- liveness. initializeDef (bai);
1425
- liveness. computeSimple ();
1428
+ liveness-> initializeDef (bai);
1429
+ liveness-> computeSimple ();
1426
1430
for (auto *consumingUse : li->getConsumingUses ()) {
1427
- if (!liveness. isWithinBoundary (consumingUse->getUser ())) {
1431
+ if (!liveness-> isWithinBoundary (consumingUse->getUser ())) {
1428
1432
diagnosticEmitter.emitAddressExclusivityHazardDiagnostic (
1429
1433
markedValue, consumingUse->getUser ());
1430
1434
emittedError = true ;
@@ -2452,9 +2456,8 @@ bool MoveOnlyAddressCheckerPImpl::performSingleCheck(
2452
2456
// to categorize the uses of this address into their ownership behavior (e.x.:
2453
2457
// init, reinit, take, destroy, etc.).
2454
2458
SmallVector<SILBasicBlock *, 32 > gatherUsesDiscoveredBlocks;
2455
- SSAPrunedLiveness gatherUsesLiveness (fn, &gatherUsesDiscoveredBlocks);
2456
2459
GatherUsesVisitor visitor (*this , addressUseState, markedAddress,
2457
- diagnosticEmitter, gatherUsesLiveness );
2460
+ diagnosticEmitter, gatherUsesDiscoveredBlocks );
2458
2461
SWIFT_DEFER { visitor.clear (); };
2459
2462
visitor.reset (markedAddress);
2460
2463
if (!visitAccessPathBaseUses (visitor, accessPathWithBase, fn)) {
0 commit comments