Skip to content

Conversation

Steelskin
Copy link
Contributor

This disables optimization on one function to work around a Swift compiler bug in the LLVM 21 rebranch.

Bug: swiftlang/llvm-project#11377

This disables optimization on one function to work around a Swift
compiler bug in the LLVM 21 rebranch.

Bug: swiftlang/llvm-project#11377
@Steelskin
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Collaborator

@owenv owenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely disabling LLVM optimizations here is probably going to have a very large impact on build perf. I think we need to take a closer look at the root cause before considering this workaround

@compnerd
Copy link
Member

@owenv we are investigating the LLVM side of the issue. PEI is at fault here, and changing that is going to take some time. This is to unblock the work for the rebranch.

CC: @bnbarham @AnthonyLatsis

@bnbarham
Copy link
Contributor

bnbarham commented Sep 18, 2025

I've started a build in swiftlang/swift#71188 to see how far we get. If this is the only issue then we still have time to keep investigating. Worst case we might be able to split things up and only apply @_optimize(none) in a much narrower case? Though having said that, this function actually isn't doing all that much work is it 🤔 (it's all mostly in the called function)?

@owenv
Copy link
Collaborator

owenv commented Sep 18, 2025

Could we restrict the attr to only target Windows? The bug seems to imply this only affects the windows prologue/epilogue emission?

@Steelskin
Copy link
Contributor Author

Could we restrict the attr to only target Windows? The bug seems to imply this only affects the windows prologue/epilogue emission?

I'll see about limiting it to Windows/arm64, since it is the only affected platform AFAIK.

@AnthonyLatsis
Copy link
Contributor

#if os(Windows)
@_optimize(none)
#endif

Should do the trick.

@owenv
Copy link
Collaborator

owenv commented Sep 18, 2025

ok, I'm ok with accepting this as a temporary change if we take @AnthonyLatsis 's suggestion

@Steelskin Steelskin requested a review from owenv September 18, 2025 19:12
@Steelskin
Copy link
Contributor Author

#if os(Windows)
@_optimize(none)
#endif

Should do the trick.

Thanks, done!

@Steelskin
Copy link
Contributor Author

@swift-ci please smoke test

@owenv
Copy link
Collaborator

owenv commented Sep 18, 2025

@swift-ci test

(we don't have smoke test jobs in this repo bc they don't build the whole stack)

@AnthonyLatsis
Copy link
Contributor

There appears to be another problematic function in SwiftPM: https://ci-external.swift.org/job/swift-PR-build-toolchain-windows-arm64/42/console

@Steelskin
Copy link
Contributor Author

@swift-ci please test linux platform

@Steelskin
Copy link
Contributor Author

@swift-ci please test macos platform

@Steelskin
Copy link
Contributor Author

It looks like there is still one unrelated failure here but I can't re-run the job.

@Steelskin
Copy link
Contributor Author

FYI, I got the full Windows arm64 toolchain building locally in conjunction with swiftlang/swift-package-manager#9178

@owenv
Copy link
Collaborator

owenv commented Sep 23, 2025

This is ok to merge, the failing job isn't fully brought up yet

@owenv owenv merged commit b14cb57 into swiftlang:main Sep 23, 2025
47 of 48 checks passed
@Steelskin Steelskin deleted the fabrice/workaround-disable-opt branch September 24, 2025 14:28
Steelskin added a commit to Steelskin/swift-swift-build that referenced this pull request Oct 7, 2025
)

The compiler bug has been fixed so the workaround is no longer
necessary.

Bug: swiftlang/llvm-project#11377
compnerd pushed a commit that referenced this pull request Oct 7, 2025
The compiler bug has been fixed so the workaround is no longer
necessary.

Bug: swiftlang/llvm-project#11377
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants