Skip to content

Commit a55a3ea

Browse files
committed
Preserve extend_lifetime during dead instruction code elimination.
1 parent fad765b commit a55a3ea

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

SwiftCompilerSources/Sources/Optimizer/Utilities/OptUtils.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ extension Instruction {
308308
// Don't remove UncheckedEnumDataInst in OSSA in case it is responsible
309309
// for consuming an enum value.
310310
return !parentFunction.hasOwnership
311+
case is ExtendLifetimeInst:
312+
// An extend_lifetime can only be removed if the operand is also removed.
313+
// If its operand is trivial, it will be removed by MandatorySimplification.
314+
return false
311315
default:
312316
break
313317
}

0 commit comments

Comments
 (0)