diff options
author | Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) <greg@krypto.org> | 2016-06-02 23:44:40 +0000 |
---|---|---|
committer | Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) <greg@krypto.org> | 2016-06-02 23:44:40 +0000 |
commit | c543a0fc3b2052c35fced09e1f96613625723508 (patch) | |
tree | f551ebf654a813212517ab06f94ca3908e67d5ea /configure | |
parent | e725777eaf430c67db5f4c9cc1f5ee77bc5ad3b5 (diff) | |
download | cpython-git-c543a0fc3b2052c35fced09e1f96613625723508.tar.gz |
Issue #25702: A --with-lto configure option has been added that will
enable link time optimizations at build time during a make profile-opt.
Some compilers and toolchains are known to not produce stable code when
using LTO, be sure to test things thoroughly before relying on it.
It can provide a few % speed up over profile-opt alone.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -667,6 +667,7 @@ LLVM_PROF_FILE LLVM_PROF_MERGER PGO_PROF_USE_FLAG PGO_PROF_GEN_FLAG +LTOFLAGS UNIVERSAL_ARCH_FLAGS BASECFLAGS OPT @@ -796,6 +797,7 @@ with_suffix enable_shared enable_profiling with_pydebug +with_lto enable_toolbox_glue with_libs with_system_expat @@ -1477,6 +1479,8 @@ Optional Packages: compiler --with-suffix=.exe set executable suffix --with-pydebug build with Py_DEBUG defined + --with-lto Enable Link Time Optimization in PGO builds. + Disabled by default. --with-libs='lib1 ...' link against additional libs --with-system-expat build pyexpat module using an installed expat library @@ -6366,6 +6370,49 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +# Enable LTO flags + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-lto" >&5 +$as_echo_n "checking for --with-lto... " >&6; } + +# Check whether --with-lto was given. +if test "${with_lto+set}" = set; then : + withval=$with_lto; +if test "$withval" != no +then + Py_LTO='true' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; +else + Py_LTO='false' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +if test "$Py_LTO" = 'true' ; then + case $CC in + *clang*) + # Any changes made here should be reflected in the GCC+Darwin case below + LTOFLAGS="-flto" + ;; + *gcc*) + case $ac_sys_system in + Darwin*) + LTOFLAGS="-flto" + ;; + *) + LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none" + ;; + esac + ;; + esac +fi + + # Enable PGO flags. |