Skip to content

Commit 08e75f2

Browse files
committed
Swift SIL: add the Operand.set API
as a shortcut for `Instruction.setOperand`
1 parent 4dcd91a commit 08e75f2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

SwiftCompilerSources/Sources/Optimizer/PassManager/Context.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,17 @@ extension AllocRefInstBase {
300300
extension UseList {
301301
func replaceAll(with replacement: Value, _ context: some MutatingContext) {
302302
for use in self {
303-
use.instruction.setOperand(at: use.index, to: replacement, context)
303+
use.set(to: replacement, context)
304304
}
305305
}
306306
}
307307

308+
extension Operand {
309+
func set(to value: Value, _ context: some MutatingContext) {
310+
instruction.setOperand(at: index, to: value, context)
311+
}
312+
}
313+
308314
extension Instruction {
309315
func setOperand(at index : Int, to value: Value, _ context: some MutatingContext) {
310316
if self is FullApplySite && index == ApplyOperands.calleeOperandIndex {

0 commit comments

Comments
 (0)