-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Enable IPO/LTO builds #14198
Enable IPO/LTO builds #14198
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Not sure, but I guess the ODR violation might be there because irrlichtmt is compiled with |
The value of using LTO vs using PR removing |
Nice. |
68264f3
to
6334b42
Compare
For now, I have to skip WIN32, because it has random weird failures (like wchar, wstring 4 vs 2 bytes, and other stuff), but if anyone wants to play with it, maybe will be enabling the LTO option too there. |
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 like to be able to enable LTO for non-Release builds too, e.g. just for getting more warnings, and also for RelWithDebInfo.
Can we have an option which just has a different default depending on the build type?
Correct me if I'm wrong, but isn't |
Thanks, fixed. Generally the size difference should tell you in 99.99% cases. |
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.
- New build option needs documentation in
doc/compiling/README.md
. - I'm getting another warning in
nodedef.cpp:737
. (At least after a trivial rebase.) - The default value is debatable. On my machine it takes about 2min with RelWithDebInfo and mold linker.
Test case: ``` $ cmake . -DRUN_IN_PLACE=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_SERVER=TRUE -DENABLE_TOUCH=FALSE minetest minetestserver W/o LTO: 13M 7.3M W/ LTO: 11M 5.9M difference: 15% 19% ``` Signed-off-by: David Heidelberg <[email protected]>
Take care about possible allocation of too large array (not likely to happen in real life (TM)). ``` /home/okias/projects/minetest/src/gui/guiTable.cpp:239:45: warning: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=] 239 | TempRow *rows = new TempRow[rowcount]; | ^ ``` Signed-off-by: David Heidelberg <[email protected]>
Compiler is afraid that variables will be uninitialized, but when is code around, he seems to be happy. Signed-off-by: David Heidelberg <[email protected]>
Signed-off-by: David Heidelberg <[email protected]>
In CI, linking takes extra time and rarely causes regressions. Signed-off-by: David Heidelberg <[email protected]>
Signed-off-by: David Heidelberg <[email protected]>
Signed-off-by: David Heidelberg <[email protected]>
Signed-off-by: David Heidelberg <[email protected]>
Done.
Initialized.
Sure, sure, thou for release it's always "right thing to do", for other builds I would say it's for consideration depending on the machine, energy cost and patience 😉 😆 |
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.
Thanks!
(Didn't test on anything other than linux x86-64 gcc mold.)
Tested on linux x86-64 gcc as well, played a bit of CTF as a "smoke test". I got the following warning when building:
but this seems to be a non-issue. One minor annoyance: |
@appgurueu I could drop the |
I wanted to to note that the errors with LTO you saw on win32:
might be a bug in GCC as someone has reported here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94156 |
Test case: ``` $ cmake . -DRUN_IN_PLACE=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_SERVER=TRUE -DENABLE_TOUCH=FALSE minetest minetestserver W/o LTO: 13M 7.3M W/ LTO: 11M 5.9M difference: 15% 19% ``` Also fixes various compiler warnings resulting from compilation using LTO. --------- Signed-off-by: David Heidelberg <[email protected]>
Test case: ``` $ cmake . -DRUN_IN_PLACE=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_SERVER=TRUE -DENABLE_TOUCH=FALSE minetest minetestserver W/o LTO: 13M 7.3M W/ LTO: 11M 5.9M difference: 15% 19% ``` Also fixes various compiler warnings resulting from compilation using LTO. --------- Signed-off-by: David Heidelberg <[email protected]>
Test case: ``` $ cmake . -DRUN_IN_PLACE=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_SERVER=TRUE -DENABLE_TOUCH=FALSE minetest minetestserver W/o LTO: 13M 7.3M W/ LTO: 11M 5.9M difference: 15% 19% ``` Also fixes various compiler warnings resulting from compilation using LTO. --------- Signed-off-by: David Heidelberg <[email protected]>
Test case: ``` $ cmake . -DRUN_IN_PLACE=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_SERVER=TRUE -DENABLE_TOUCH=FALSE minetest minetestserver W/o LTO: 13M 7.3M W/ LTO: 11M 5.9M difference: 15% 19% ``` Also fixes various compiler warnings resulting from compilation using LTO. --------- Signed-off-by: David Heidelberg <[email protected]>
Test case: ``` $ cmake . -DRUN_IN_PLACE=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_SERVER=TRUE -DENABLE_TOUCH=FALSE minetest minetestserver W/o LTO: 13M 7.3M W/ LTO: 11M 5.9M difference: 15% 19% ``` Also fixes various compiler warnings resulting from compilation using LTO. --------- Signed-off-by: David Heidelberg <[email protected]>
Test case: ``` $ cmake . -DRUN_IN_PLACE=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_SERVER=TRUE -DENABLE_TOUCH=FALSE minetest minetestserver W/o LTO: 13M 7.3M W/ LTO: 11M 5.9M difference: 15% 19% ``` Also fixes various compiler warnings resulting from compilation using LTO. --------- Signed-off-by: David Heidelberg <[email protected]>
Enabling IPO/LTO leads to faster loading times, better performance, more efficient cache usage, and a reduction in binaries size.
Cons: Release build compilation takes longer and consumes more energy (thou disabling it for CI builds makes sense).
Only DEBUG build default setting is OFF, otherwise it's ON by default.
Different version of abandoned #13192
TODO:
ENABLE_LTO
for CI builds.