Skip to content

[SILOptimizer] Turn "is self-recursive" check into analysis #80236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Mar 24, 2025

The body of a function has to be re-analyzed for every call site of the function, which is very expensive and if the body is not changed would produce the same result.

This takes about ~10% from swift-syntax overall build time in release configuration.

The body of a function has to be re-analyzed for every call
site of the function, which is very expensive and if the
body is not changed would produce the same result.

This takes about ~10% from swift-syntax overall build time
in release configuration.
@xedin xedin requested a review from eeckstein as a code owner March 24, 2025 07:39
@xedin
Copy link
Contributor Author

xedin commented Mar 24, 2025

@swift-ci please test

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@eeckstein
Copy link
Contributor

@swift-ci apple silicon benchmark

@eeckstein
Copy link
Contributor

@swift-ci benchmark

@xedin
Copy link
Contributor Author

xedin commented Mar 24, 2025

@swift-ci apple silicon benchmark

@xedin
Copy link
Contributor Author

xedin commented Mar 24, 2025

Apple silicon benchmark fails with:

swift-macosx-arm64/stdlib/public/Cxx/std/849d5d6e8e416fae1de80805b6550fbf57047759.txt
<unknown>:0: error: could not find module 'CxxStdlib' for target 'arm64-apple-macos'; found: x86_64-apple-macos, at: /Users/ec2-user/jenkins/workspace/swift-PR-macos-perf-apple-silicon/Ninja-Release/swift-macosx-arm64/lib/swift/macosx/CxxStdlib.swiftmodule
<unknown>:0: error: could not find module 'CxxStdlib' for target 'arm64-apple-macos'; found: x86_64-apple-macos, at: /Users/ec2-user/jenkins/workspace/swift-PR-macos-perf-apple-silicon/Ninja-Release/swift-macosx-arm64/lib/swift/macosx/CxxStdlib.swiftmodule

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

Nice!

@bnbarham
Copy link
Contributor

Thanks @xedin 😍 !

// Force the compiler to generate the destructor in this C++ file.
// Otherwise it can happen that it is generated in a SwiftCompilerSources module
// and that results in unresolved-symbols linker errors.
IsSelfRecursive::~IsSelfRecursive() = default;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not just the destructor right, isn't this the way to convince clang to place the vtable in this TU?

@xedin xedin merged commit 5af7e0d into swiftlang:main Mar 25, 2025
6 of 7 checks passed
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.

5 participants