From 09f6f4f9b608d57fceba9de2d5a237ee9be8b626 Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Wed, 22 Jan 2025 20:30:21 +0100 Subject: [PATCH] AutodiffClosureSpecialization: workaround a problem with OSSA. Disable the closure specializer optimization for closures in OSSA until the underlying problem is fixed. https://github.com/swiftlang/swift/issues/78847 Part of rdar://140229560 --- .../Optimizer/FunctionPasses/ClosureSpecialization.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ClosureSpecialization.swift b/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ClosureSpecialization.swift index e0c1a4928a042..19f41dac5c0c3 100644 --- a/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ClosureSpecialization.swift +++ b/SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ClosureSpecialization.swift @@ -503,6 +503,12 @@ private func handleApplies(for rootClosure: SingleValueInstruction, callSiteMap: continue } + // Workaround for a problem with OSSA: https://github.com/swiftlang/swift/issues/78847 + // TODO: remove this if-statement once the underlying problem is fixed. + if callee.hasOwnership { + continue + } + if callee.isDefinedExternally { continue }