mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SwiftCompilerSources: improve APIs for UseList
Make filter APIs for UseList chainable by adding them to Sequence where Element == Operand For example, it allows to write: ``` let singleUse = value.uses.ignoreDebugUses.ignoreUsers(ofType: EndAccessInst.self).singleUse ``` Also, add `UseList.getSingleUser(notOfType:)`
This commit is contained in:
@@ -365,9 +365,7 @@ private struct StackProtectionOptimization {
|
||||
let builder = Builder(after: beginAccess, location: beginAccess.location.autoGenerated, context)
|
||||
let temporary = builder.createAllocStack(beginAccess.type)
|
||||
|
||||
for use in beginAccess.uses where !(use.instruction is EndAccessInst) {
|
||||
use.instruction.setOperand(at: use.index, to: temporary, context)
|
||||
}
|
||||
beginAccess.uses.ignoreUsers(ofType: EndAccessInst.self).replaceAll(with: temporary, context)
|
||||
|
||||
for endAccess in beginAccess.endInstructions {
|
||||
let endBuilder = Builder(before: endAccess, location: endAccess.location.autoGenerated, context)
|
||||
|
||||
Reference in New Issue
Block a user