From 8aef28825e050adaa1f2baf623670806bbb84b54 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Thu, 18 Sep 2025 14:19:42 -0400 Subject: [PATCH 1/2] Disable optimization to work around a compiler bug This disables optimization on one function to work around a Swift compiler bug in the LLVM 21 rebranch. Bug: swiftlang/llvm-project#11377 --- Sources/SWBTaskExecution/BuildDescriptionManager.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/SWBTaskExecution/BuildDescriptionManager.swift b/Sources/SWBTaskExecution/BuildDescriptionManager.swift index 248bca9e..0da7ce36 100644 --- a/Sources/SWBTaskExecution/BuildDescriptionManager.swift +++ b/Sources/SWBTaskExecution/BuildDescriptionManager.swift @@ -175,6 +175,9 @@ package final class BuildDescriptionManager: Sendable { /// NOTE: This is primarily accessible for performance testing purposes, actual clients should prefer to access via the cached methods. /// /// - Returns: A build description, or nil if cancelled. + // TODO: Optimizations are disabled to work around a compiler bug. Remove this attribute when the bug is fixed. + // See https://github.com/swiftlang/llvm-project/issues/11377 for details. + @_optimize(none) package static func constructBuildDescription(_ plan: BuildPlan, planRequest: BuildPlanRequest, signature: BuildDescriptionSignature, inDirectory path: Path, fs: any FSProxy, bypassActualTasks: Bool = false, planningDiagnostics: [ConfiguredTarget?: [Diagnostic]], delegate: any BuildDescriptionConstructionDelegate) async throws -> BuildDescription? { BuildDescriptionManager.descriptionsComputed.increment() From 49cfd3851f09465ec689dcc8b9719198e9383aa2 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Thu, 18 Sep 2025 15:11:53 -0400 Subject: [PATCH 2/2] Limit disabling to Windows --- Sources/SWBTaskExecution/BuildDescriptionManager.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/SWBTaskExecution/BuildDescriptionManager.swift b/Sources/SWBTaskExecution/BuildDescriptionManager.swift index 0da7ce36..c82ebf46 100644 --- a/Sources/SWBTaskExecution/BuildDescriptionManager.swift +++ b/Sources/SWBTaskExecution/BuildDescriptionManager.swift @@ -177,7 +177,9 @@ package final class BuildDescriptionManager: Sendable { /// - Returns: A build description, or nil if cancelled. // TODO: Optimizations are disabled to work around a compiler bug. Remove this attribute when the bug is fixed. // See https://github.com/swiftlang/llvm-project/issues/11377 for details. + #if os(Windows) @_optimize(none) + #endif package static func constructBuildDescription(_ plan: BuildPlan, planRequest: BuildPlanRequest, signature: BuildDescriptionSignature, inDirectory path: Path, fs: any FSProxy, bypassActualTasks: Bool = false, planningDiagnostics: [ConfiguredTarget?: [Diagnostic]], delegate: any BuildDescriptionConstructionDelegate) async throws -> BuildDescription? { BuildDescriptionManager.descriptionsComputed.increment()