IRGen: Switch LLVM pipeline optimization level from Os to O2#89632
Draft
AnthonyLatsis wants to merge 2 commits into
Draft
IRGen: Switch LLVM pipeline optimization level from Os to O2#89632AnthonyLatsis wants to merge 2 commits into
AnthonyLatsis wants to merge 2 commits into
Conversation
Collaborator
Author
|
@swift-ci please benchmark |
kavon
approved these changes
Jun 2, 2026
kavon
left a comment
Member
There was a problem hiding this comment.
LGTM assuming no significant changes in the benchmark results
hamishknight
approved these changes
Jun 2, 2026
| // Splitting trades code size to enhance memory locality, avoid in -Osize. | ||
| DoHotColdSplit = Opts.EnableHotColdSplit && !Opts.optimizeForSize(); | ||
| level = llvm::OptimizationLevel::Os; | ||
| level = llvm::OptimizationLevel::O2; |
Contributor
There was a problem hiding this comment.
Can you add a comment here covering what you have in the PR description? Just so it's obvious for future folks reading the code
Collaborator
Author
|
@swift-ci please benchmark |
Collaborator
Author
|
We got improvements and regressions. Now trying Os → O2 plus adding the |
Os is gone upstream: llvm/llvm-project#191363. This can only affect `-O` builds: * We always emit IR functions with the `optsize` and `minsize` attributes in `-Osize` mode. * The only place in LLVM where pipeline Os matters is `FunctionSpecializer`, where we already skip functions with the `optsize` or `minsize` attribute.
This reverts commit 2cb0f2c.
Collaborator
Author
|
@swift-ci please benchmark |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Os is gone upstream: llvm/llvm-project#191363. This change can only affect
-Obuilds:optsizeandminsizeattributes in-Osizemode:swift/lib/IRGen/IRGenModule.cpp
Lines 1560 to 1565 in 85e5036
FunctionSpecializer, where we already skip functions with theoptsizeorminsizeattribute.