Skip to content

Commit ffe9c48

Browse files
committed
Add LocalVariableUtils
This includes a reaching-def analysis that can be used by diagnostic passes. Diagnostics should be flow-sensitive.
1 parent 75f2f88 commit ffe9c48

File tree

3 files changed

+843
-1
lines changed

3 files changed

+843
-1
lines changed

SwiftCompilerSources/Sources/Optimizer/Utilities/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ swift_compiler_sources(Optimizer
1515
ForwardingUtils.swift
1616
FunctionSignatureTransforms.swift
1717
LifetimeDependenceUtils.swift
18+
LocalVariableUtils.swift
1819
OptUtils.swift
1920
OwnershipLiveness.swift
2021
SSAUpdater.swift

SwiftCompilerSources/Sources/Optimizer/Utilities/ForwardingUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ extension NonEscapingClosureDefUseWalker: ForwardingDefUseWalker {
386386
mutating func nonForwardingUse(of operand: Operand) -> WalkResult {
387387
// Nonescaping closures may be moved, copied, or borrowed.
388388
if let transition = operand.instruction as? OwnershipTransitionInstruction {
389-
return walkDownUses(of: transition, using: operand)
389+
return walkDownUses(of: transition.ownershipResult, using: operand)
390390
}
391391
// Otherwise, assume the use cannot propagate the closure context.
392392
return closureContextLeafUse(of: operand)

0 commit comments

Comments
 (0)