Skip to content

Commit b4010e6

Browse files
committed
SIL: add a small utility Instruction.isUsing which checks if a value is in its operand list
1 parent 502c0eb commit b4010e6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

SwiftCompilerSources/Sources/SIL/Operand.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ extension Value {
191191
public var users: LazyMapSequence<UseList, Instruction> { uses.users }
192192
}
193193

194+
extension Instruction {
195+
public func isUsing(_ value: Value) -> Bool {
196+
return operands.contains { $0.value == value }
197+
}
198+
}
199+
194200
extension Operand {
195201
/// Return true if this operation will store a full value into this
196202
/// operand's address.

0 commit comments

Comments
 (0)