Skip to content

Commit b734bb3

Browse files
committed
Expose hasOnlyEndOfScopeOrDestroyUses as a utility
for cross-file use.
1 parent 825185d commit b734bb3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

include/swift/SILOptimizer/Utils/InstOptUtils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ NullablePtr<SILInstruction> createDecrementBefore(SILValue ptr,
6868
/// Get the insertion point after \p val.
6969
Optional<SILBasicBlock::iterator> getInsertAfterPoint(SILValue val);
7070

71+
/// True if this instruction's only uses are debug_value (in -O mode),
72+
/// destroy_value, or end-of-scope instruction such as end_borrow.
73+
bool hasOnlyEndOfScopeOrDestroyUses(SILInstruction *inst);
74+
7175
/// Return the number of @inout arguments passed to the given apply site.
7276
unsigned getNumInOutArguments(FullApplySite applySite);
7377

lib/SILOptimizer/Utils/InstOptUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ bool swift::isIntermediateRelease(SILInstruction *inst,
211211
return false;
212212
}
213213

214-
static bool hasOnlyEndOfScopeOrDestroyUses(SILInstruction *inst) {
214+
bool swift::hasOnlyEndOfScopeOrDestroyUses(SILInstruction *inst) {
215215
for (SILValue result : inst->getResults()) {
216216
for (Operand *use : result->getUses()) {
217217
SILInstruction *user = use->getUser();

0 commit comments

Comments
 (0)