Skip to content

Commit b52ccce

Browse files
committed
Add ScopedAddressValue::forUse to find use points
These are the use points for begin_access and store_borrow operands.
1 parent d8e1fca commit b52ccce

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/swift/SIL/ScopedAddressUtils.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ struct ScopedAddressValue {
7474
return kind != ScopedAddressValueKind::Invalid && value;
7575
}
7676

77+
// Both the store_borrow source and address operands are effectively used for
78+
// the duration of the address scope.
79+
static ScopedAddressValue forUse(Operand *use) {
80+
if (auto svi = dyn_cast<SingleValueInstruction>(use->getUser()))
81+
return ScopedAddressValue(svi);
82+
83+
return ScopedAddressValue();
84+
}
85+
7786
void print(llvm::raw_ostream &os) const;
7887
SWIFT_DEBUG_DUMP { print(llvm::dbgs()); }
7988

0 commit comments

Comments
 (0)