-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
add ReleaseSmall mode #531
Comments
Entities are not to be multiplied without necessity. There are two "natural" build modes:
There could be third mode, "custom", allowing all possible combinations: release with tests, release with safety checks, debug without tests (for fast recompilation), release with "performance measuring tests", variant with embedded web server to provide insight into app's internal state, etc. |
Does LLVM support tree shaking or dead code elimination? If yes, why should be there be a special mode for this instead of being the default in release mode? If not, what exactly would happen in ReleaseSmall mode that would enable smaller binaries? |
Loop unrolling and auto-vectorization are two examples which you may not want that otherwise are likely to occur in Release mode without an explicit size setting. Right now it seems that we only either forward the general I had a bit of a look at the specific passes that are enabled by these options for some specific examples but its a bit unwieldy to find at an immediate glance in llvm. |
When people are concerned with binary size, aren't they usually concerned about unused libraries? e.g. people complaining about the size of a hello world program in go-lang. What's the use case for people who want to prevent loop unrolling? I mean how many kilobytes would it save? If it's really required, wouldn't it be better left as a |
Sure, that is a problem, but I think given that we typically compile all source as one entire unit (plus lto) and dead code elimination is performed by llvm (pretty sure even at minimal optimization level?) there isn't much extra in the standard case to do here. I suspect the savings achieved by size targetted optimizations are more than you'd find at first glance. A good example can be seen for sqlite under different compilation settings. https://sqlite.org/footprint.html This would be especially useful for size-constrained embedded programs, too. |
Possible way to deal with ever expanding number of compiler modes:
|
We currently have these build modes:
-O0
)-O3
)-O3
)Add:
-Os
)This also lets libraries check for the release mode and make different decisions. E.g. maybe the float printing code uses a slower implementation without a table of precomputed information in ReleaseSmall mode.
The text was updated successfully, but these errors were encountered: