-
Notifications
You must be signed in to change notification settings - Fork 13.4k
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
3290111
to
d83495c
Compare
This comment has been minimized.
This comment has been minimized.
d83495c
to
2413eb4
Compare
This comment has been minimized.
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.
2413eb4
to
71b39e5
Compare
@@ -407,6 +424,8 @@ This option lets you control what happens when the code panics. | |||
|
|||
If not specified, the default depends on the target. | |||
|
|||
If any crate in the crate graph uses `abort`, the final binary (`bin`, `dylib`, `cdylib`, `staticlib`) must also use `abort`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if libstd is used as dylib compiled with panic=unwind, the final binary must also use panic=unwind. (In that case libstd.so links against libpanic_unwind.rlib. rustc will emit an error when using panic=abort while linking libpanic_unwind.rlib)
This adds more information to many different codegen options. It should not add any new guarantees, just document existing behavior.
r? bjorn3