Skip to content

Commit 800cd3f

Browse files
committed
[NFC] OwnedLifetimeCan: Remove spurious array.
Inlined a single-caller method and removed the array that was created only to be iterated over once.
1 parent 6fd25f6 commit 800cd3f

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

include/swift/SILOptimizer/Utils/CanonicalizeOSSALifetime.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ class CanonicalizeOSSALifetime final {
472472
void findExtendedBoundary(PrunedLivenessBoundary const &originalBoundary,
473473
PrunedLivenessBoundary &boundary);
474474

475-
void findDestroysOutsideBoundary(SmallVectorImpl<SILInstruction *> &destroys);
476475
void extendLivenessToDeinitBarriers();
477476

478477
void extendUnconsumedLiveness(PrunedLivenessBoundary const &boundary);

lib/SILOptimizer/Utils/CanonicalizeOSSALifetime.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -252,26 +252,16 @@ bool CanonicalizeOSSALifetime::computeCanonicalLiveness() {
252252
return true;
253253
}
254254

255-
void CanonicalizeOSSALifetime::findDestroysOutsideBoundary(
256-
SmallVectorImpl<SILInstruction *> &outsideDestroys) {
257-
for (auto destroy : destroys) {
258-
if (liveness->isWithinBoundary(destroy))
259-
continue;
260-
outsideDestroys.push_back(destroy);
261-
}
262-
}
263-
264255
void CanonicalizeOSSALifetime::extendLivenessToDeinitBarriers() {
265-
SmallVector<SILInstruction *, 4> outsideDestroys;
266-
findDestroysOutsideBoundary(outsideDestroys);
267-
268256
// OSSALifetimeCompletion: With complete lifetimes, creating completeLiveness
269257
// and using it to visit unreachable lifetime ends should be deleted.
270258
SmallVector<SILBasicBlock *, 32> discoveredBlocks(this->discoveredBlocks);
271259
SSAPrunedLiveness completeLiveness(*liveness, &discoveredBlocks);
272260

273-
for (auto *end : outsideDestroys) {
274-
completeLiveness.updateForUse(end, /*lifetimeEnding*/ true);
261+
for (auto destroy : destroys) {
262+
if (liveness->isWithinBoundary(destroy))
263+
continue;
264+
completeLiveness.updateForUse(destroy, /*lifetimeEnding*/ true);
275265
}
276266

277267
OSSALifetimeCompletion::visitAvailabilityBoundary(

0 commit comments

Comments
 (0)