Skip to content

Commit f623a87

Browse files
committed
Swift Optimizer: add LoadInst.set(ownership:)
1 parent ff913d2 commit f623a87

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

SwiftCompilerSources/Sources/Optimizer/PassManager/Context.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,14 @@ extension GlobalValueInst {
448448
}
449449
}
450450

451+
extension LoadInst {
452+
func set(ownership: LoadInst.LoadOwnership, _ context: some MutatingContext) {
453+
context.notifyInstructionsChanged()
454+
bridged.LoadInst_setOwnership(ownership.rawValue)
455+
context.notifyInstructionChanged(self)
456+
}
457+
}
458+
451459
extension TermInst {
452460
func replaceBranchTarget(from fromBlock: BasicBlock, to toBlock: BasicBlock, _ context: some MutatingContext) {
453461
context.notifyBranchesChanged()

include/swift/SIL/SILBridging.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,10 @@ struct BridgedInstruction {
804804
getAs<swift::GlobalValueInst>()->setBare(true);
805805
}
806806

807+
void LoadInst_setOwnership(SwiftInt ownership) const {
808+
getAs<swift::LoadInst>()->setOwnershipQualifier((swift::LoadOwnershipQualifier)ownership);
809+
}
810+
807811
SWIFT_IMPORT_UNSAFE
808812
inline BridgedBasicBlock CheckedCastBranch_getSuccessBlock() const;
809813

0 commit comments

Comments
 (0)