Skip to content

Commit d361be9

Browse files
committed
Cleanup DiagnoseLifetimeIssues to use PrunedLiveness.
1 parent 8996fb8 commit d361be9

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

lib/SILOptimizer/Mandatory/DiagnoseLifetimeIssues.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -315,24 +315,7 @@ static bool isOutOfLifetime(SILInstruction *inst, PrunedLiveness &liveness) {
315315
// impossible that a use of the object is not a potential load. So we would
316316
// always see a potential load if the lifetime of the object goes beyond the
317317
// store_weak.
318-
319-
SILBasicBlock *block = inst->getParent();
320-
if (liveness.getBlockLiveness(block) != PrunedLiveBlocks::LiveWithin)
321-
return false;
322-
323-
// If there are any uses after the store_weak, it means that the liferange of
324-
// the object goes beyond the store_weak.
325-
for (SILInstruction &inst : make_range(std::next(inst->getIterator()),
326-
block->end())) {
327-
switch (liveness.isInterestingUser(&inst)) {
328-
case PrunedLiveness::NonUser:
329-
break;
330-
case PrunedLiveness::NonLifetimeEndingUse:
331-
case PrunedLiveness::LifetimeEndingUse:
332-
return false;
333-
}
334-
}
335-
return true;
318+
return !liveness.isWithinBoundary(inst);
336319
}
337320

338321
/// Reports a warning if the stored object \p storedObj is never loaded within

0 commit comments

Comments
 (0)