← Back to team overview

maria-discuss team mailing list archive

Re: LTO build fails likely because -static-libgcc

 



Am 21.01.2017 um 06:59 schrieb Reindl Harald:
why does MariaDB use "-g -static-libgcc" in "mysql_release.cmake" and so
besides override -g0 break -flto builds?

-O3 -g -static-libgcc

it also should not override with -O3 because the previous -O3 followed by some -fno-options has a reason - not enable optimizations which are pointless and in doubt doing more harm than good

-O3 -fno-strict-aliasing -fno-gcse-after-reload -fno-inline-functions -fno-ipa-cp -fno-ipa-cp-clone -fno-peel-loops -fno-predictive-commoning -fno-tree-loop-distribute-patterns -fno-unswitch-loops

see deeper informations below, so the blank -O3 is pointless and not breaking -flto would gain much more in context of performance
________________________________

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
-O3 enables options which are clearly statet as "generally profitable only with profile feedback" and so just blows up the binary size for no benefit

doing a profile-guided-optimization is not done with just a simple build

you need two builds and running the application with typical use-cases/benchmarks while the first build instructs GCC to generate profiling code, the usage of the intermediate-build then stores runtime informations in .gcda files and after a "make prof-clean" which deletes anything but the .gcda files "-fprofile-use" is using that informations for otpimize the binary

-fprofile-use=path
Enable profile feedback-directed optimizations, and the following optimizations which are generally profitable only with profile feedback available: -fbranch-probabilities, -fvpt, -funroll-loops, -fpeel-loops, -ftracer, -ftree-vectorize, and ftree-loop-distribute-patterns.

-fauto-profile=path
Enable sampling-based feedback-directed optimizations, and the following optimizations which are generally profitable only with profile feedback available: -fbranch-probabilities, -fvpt, -funroll-loops, -fpeel-loops, -ftracer, -ftree-vectorize, -finline-functions, -fipa-cp, -fipa-cp-clone, -fpredictive-commoning, -funswitch-loops, -fgcse-after-reload, and -ftree-loop-distribute-patterns.


Follow ups

References