Skip to content

Commit 88103a7

Browse files
committed
[InstructionDeleter] Add fixLifetime argument.
Clients may not want the lifetime to be fixed up.
1 parent 689fe3a commit 88103a7

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

include/swift/SILOptimizer/Utils/InstructionDeleter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class InstructionDeleter {
159159
///
160160
/// Calls callbacks.notifyWillBeDeleted().
161161
bool deleteIfDead(SILInstruction *inst);
162+
bool deleteIfDead(SILInstruction *inst, bool fixLifetime);
162163

163164
/// Delete the instruction \p inst, ignoring its side effects. If any operand
164165
/// definitions will become dead after deleting this instruction, track them

lib/SILOptimizer/Utils/InstructionDeleter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ void InstructionDeleter::cleanupDeadInstructions() {
276276

277277
bool InstructionDeleter::deleteIfDead(SILInstruction *inst) {
278278
bool fixLifetime = inst->getFunction()->hasOwnership();
279+
return deleteIfDead(inst, fixLifetime);
280+
}
281+
282+
bool InstructionDeleter::deleteIfDead(SILInstruction *inst, bool fixLifetime) {
279283
if (isInstructionTriviallyDead(inst)
280284
|| isScopeAffectingInstructionDead(inst, fixLifetime)) {
281285
getCallbacks().notifyWillBeDeleted(inst);

0 commit comments

Comments
 (0)