LinearLifetimeChecker - make DeadEndBlocks optional

This commit is contained in:
Andrew Trick
2021-10-20 15:05:43 -07:00
parent 2743b83b8e
commit 103a6fefb8
9 changed files with 38 additions and 25 deletions

View File

@@ -88,7 +88,7 @@ public:
SmallVector<Operand *, 8> endScopeUses;
transform(access->getEndAccesses(), std::back_inserter(endScopeUses),
[](EndAccessInst *eai) { return &eai->getAllOperands()[0]; });
LinearLifetimeChecker checker(ctx.getDeadEndBlocks());
LinearLifetimeChecker checker(&ctx.getDeadEndBlocks());
if (!checker.validateLifetime(access, endScopeUses,
liveRange.getAllConsumingUses())) {
// If we fail the linear lifetime check, then just recur:
@@ -138,7 +138,7 @@ public:
// Ok, we have some writes. See if any of them are within our live
// range. If any are, we definitely can not promote to load_borrow.
SmallVector<BeginAccessInst *, 16> foundBeginAccess;
LinearLifetimeChecker checker(ctx.getDeadEndBlocks());
LinearLifetimeChecker checker(&ctx.getDeadEndBlocks());
SILValue introducerValue = liveRange.getIntroducer().value;
if (!checker.usesNotContainedWithinLifetime(introducerValue,
liveRange.getDestroyingUses(),
@@ -244,7 +244,7 @@ public:
value.visitLocalScopeEndingUses(
[&](Operand *use) { endScopeInsts.push_back(use); return true; });
LinearLifetimeChecker checker(ctx.getDeadEndBlocks());
LinearLifetimeChecker checker(&ctx.getDeadEndBlocks());
// Returns true on success. So we invert.
bool foundError = !checker.validateLifetime(
@@ -291,7 +291,7 @@ public:
// Then make sure that all of our load [copy] uses are within the
// destroy_addr.
LinearLifetimeChecker checker(ctx.getDeadEndBlocks());
LinearLifetimeChecker checker(&ctx.getDeadEndBlocks());
// Returns true on success. So we invert.
bool foundError = !checker.validateLifetime(
stack, addrDestroyingOperands /*consuming users*/,