On Fri, 12 Aug 2022 16:45:21 GMT, Julian Waters <jwat...@openjdk.org> wrote:
>> The support for Link Time Optimization in the JDK's make system could do >> with some cleaning up, at the moment it simply assumes the compiler is gcc >> and sets the flags as such. Instead of introducing changes in bulk, as a >> first step, it would be good to simply supply the appropriate flags >> depending on the compiler and refine the flags for the one existing compiler >> with support for it. In practice the latter just means adding the proper >> -fuse-linker-plugin to gcc compile step when link-time-opt is specified, as >> without it the compiler generates both native code and information rich >> representation for Link Time Optimization. With this flag, native code >> generation is disabled and object files will contain only code required for >> Link Time Optimization, thus speeding up compile times as well. > > Julian Waters has updated the pull request incrementally with one additional > commit since the last revision: > > JVM_OPTIMIZATION is compiler agnostic Technically this change seems reasonable, but I tend to agree with David that it is more likely that a better solution would be to remove this completely. Have you tried building with LTO enabled? What kind of build times do you get -- and what kind of improvements in terms of file size and performance? My gut feeling is that there is no way that the small potential improvements can counteract the huge negative impact of build times magnitudes larger. ------------- PR: https://git.openjdk.org/jdk/pull/9829