Skip to content

Commit ea3d6e3

Browse files
committed
[CanonicalizeOSSALifetime] Swapped ignore meaning.
In various places, CanonicalizeOSSALifetime checks whether instructions are "interesting enough to be worth hoisting over" for the purpose of avoiding hoisting over instructions that would result in churning and failing to find a fixed point when iterating in CopyPropagation. Elsewhere, ::ignoredByDestroyHoisting is used. Previously, findDestroyOnCFGEdge used isIncidentalUse. Replaced that useage with ::ignoredByDestroyHoisting.
1 parent 2f36201 commit ea3d6e3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/SILOptimizer/Utils/CanonicalOSSALifetime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,12 +411,12 @@ void CanonicalizeOSSALifetime::extendLivenessThroughOverlappingAccess() {
411411
// liveness computed in Step 1.
412412
//===----------------------------------------------------------------------===//
413413

414-
// Look past destroys and incidental uses to find a destroy on \p edgeBB that
414+
// Look past ignoreable instructions to find a destroy on \p edgeBB that
415415
// destroys \p def.
416416
static DestroyValueInst *findDestroyOnCFGEdge(SILBasicBlock *edgeBB,
417417
SILValue def) {
418418
for (auto &inst : *edgeBB) {
419-
if (isIncidentalUse(&inst))
419+
if (CanonicalizeOSSALifetime::ignoredByDestroyHoisting(inst.getKind()))
420420
continue;
421421
if (auto *destroy = dyn_cast<DestroyValueInst>(&inst)) {
422422
if (destroy->getOperand() == def)

test/SILOptimizer/lexical_destroy_folding.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,8 @@ exit:
574574
// CHECK: [[COPY:%[^,]+]] = copy_value [[LIFETIME]]
575575
// CHECK: cond_br undef, [[LEFT:bb[0-9]+]], [[RIGHT:bb[0-9]+]]
576576
// CHECK: [[LEFT]]:
577-
// CHECK: destroy_value [[COPY]]
578577
// CHECK: [[CALLEE_OWNED:%[^,]+]] = function_ref @callee_owned
578+
// CHECK: destroy_value [[COPY]]
579579
// CHECK: end_borrow [[LIFETIME]]
580580
// CHECK: apply [[CALLEE_OWNED]]([[MOVE]])
581581
// CHECK: br [[EXIT:bb[0-9]+]]

0 commit comments

Comments
 (0)