Skip to content

Commit 3f42ad7

Browse files
committed
DeadObjectElimination: don't let fix_lifetime prevent dead array elimination
1 parent 216eec2 commit 3f42ad7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/SILOptimizer/Transforms/DeadObjectElimination.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,8 @@ recursivelyCollectInteriorUses(ValueBase *DefInst,
412412

413413
// Lifetime endpoints that don't allow the address to escape.
414414
if (isa<RefCountingInst>(User) ||
415-
isa<DebugValueInst>(User)) {
415+
isa<DebugValueInst>(User) ||
416+
isa<FixLifetimeInst>(User)) {
416417
AllUsers.insert(User);
417418
continue;
418419
}

test/SILOptimizer/dead_array_elim.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ bb0:
4343
%12 = struct_extract %11 : $UnsafeMutablePointer<Int>, #UnsafeMutablePointer._rawValue
4444
%f = function_ref @finalize : $@convention(thin) (@owned Array<Int>) -> @owned Array<Int>
4545
%a = apply %f(%10) : $@convention(thin) (@owned Array<Int>) -> @owned Array<Int>
46+
fix_lifetime %a : $Array<Int>
4647
%13 = struct_extract %a : $Array<Int>, #Array._buffer
4748
%14 = struct_extract %13 : $_ArrayBuffer<Int>, #_ArrayBuffer._storage
4849
%15 = struct_extract %14 : $_BridgeStorage<__ContiguousArrayStorageBase>, #_BridgeStorage.rawValue

0 commit comments

Comments
 (0)