Skip to content

Improve documentation for codegen options #141554

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
Jun 3, 2025

Conversation

Noratrieb
Copy link
Member

This adds more information to many different codegen options. It should not add any new guarantees, just document existing behavior.

r? bjorn3

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 25, 2025
@@ -379,7 +396,7 @@ This flag controls the optimization level.
* `2`: some optimizations.
* `3`: all optimizations.
* `s`: optimize for binary size.
* `z`: optimize for binary size, but also turn off loop vectorization.
* `z`: optimize for binary size, but more aggressively. Often results in larger binaries than `s`
Copy link
Member Author

Choose a reason for hiding this comment

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

I took the description from https://llvm.org/doxygen/classllvm_1_1OptimizationLevel.html#a1e916712888d6a2d3952834c126460e7

The fact that it's often worse is based on experience

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd guess the old information was based on https://stackoverflow.com/questions/15548023/clang-optimization-levels
But that misses all the heuristics that are also affected by this flag, which are much more important (there's no way just not doing vectorization results in significantly bigger binaries)

@Noratrieb Noratrieb force-pushed the document-codegen-opts-better branch from 3290111 to d83495c Compare May 25, 2025 16:49
@rust-log-analyzer

This comment has been minimized.

@Noratrieb Noratrieb force-pushed the document-codegen-opts-better branch from d83495c to 2413eb4 Compare May 25, 2025 17:45
@rust-log-analyzer

This comment has been minimized.

@Noratrieb Noratrieb force-pushed the document-codegen-opts-better branch from 2413eb4 to 71b39e5 Compare May 25, 2025 18:43
@Noratrieb Noratrieb force-pushed the document-codegen-opts-better branch from 71b39e5 to 8723cde Compare June 1, 2025 12:15
@rust-log-analyzer

This comment has been minimized.

This adds more information to many different codegen options. It should
not add any new guarantees, just document existing behavior.
@Noratrieb Noratrieb force-pushed the document-codegen-opts-better branch from 8723cde to 198e89b Compare June 1, 2025 20:21
@bjorn3
Copy link
Member

bjorn3 commented Jun 3, 2025

@bors r+ rollup=always

@bors
Copy link
Collaborator

bors commented Jun 3, 2025

📌 Commit 198e89b has been approved by bjorn3

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 3, 2025
bors added a commit that referenced this pull request Jun 3, 2025
Rollup of 9 pull requests

Successful merges:

 - #141554 (Improve documentation for codegen options)
 - #141817 (rustc_llvm: add Windows system libs only when cross-compiling from Wi…)
 - #141843 (Add `visit_id` to ast `Visitor`)
 - #141881 (Subtree update of `rust-analyzer`)
 - #141898 ([rustdoc-json] Implement PartialOrd and Ord for rustdoc_types::Id)
 - #141921 (Disable f64 minimum/maximum tests for arm 32)
 - #141930 (Enable triagebot `[concern]` functionality)
 - #141936 (Decouple "reporting in deps" from `FutureIncompatibilityReason`)
 - #141949 (move `test-float-parse` tool into `src/tools` dir)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 807778a into rust-lang:master Jun 3, 2025
9 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 3, 2025
rust-timer added a commit that referenced this pull request Jun 3, 2025
Rollup merge of #141554 - Noratrieb:document-codegen-opts-better, r=bjorn3

Improve documentation for codegen options

This adds more information to many different codegen options. It should not add any new guarantees, just document existing behavior.

r? bjorn3
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 4, 2025
…ommend-over-recommended, r=lqd

Fix incorrect use of "recommend" over "recommended"

Spotted this typo in rust-lang#141554, but it has since been merged.

r? `@Noratrieb`
rust-timer added a commit that referenced this pull request Jun 5, 2025
Rollup merge of #142017 - Rageking8:fix-incorrect-use-of-recommend-over-recommended, r=lqd

Fix incorrect use of "recommend" over "recommended"

Spotted this typo in #141554, but it has since been merged.

r? `@Noratrieb`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants