FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-89536: Use ThinLTO policy if possible by corona10 · Pull Request #96766 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ac  (1) .rst  (3) No extension  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
3 changes: 3 additions & 0 deletions Doc/using/configure.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ also be used to improve performance.
.. versionadded:: 3.11
To use ThinLTO feature, use ``--with-lto=thin`` on Clang.

.. versionchanged:: 3.12
Use ThinLTO as the default optimization policy on Clang if the compiler accepts the flag.

.. cmdoption:: --enable-bolt

Enable usage of the `BOLT post-link binary optimizer
Expand Down
4 changes: 4 additions & 0 deletions Doc/whatsnew/3.12.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ Build Changes
``va_start()`` is no longer called with a single parameter.
(Contributed by Kumar Aditya in :gh:`93207`.)

* CPython now uses the ThinLTO option as the default link time optimization policy
if the Clang compiler accepts the flag.
(Contributed by Dong-hee Na in :gh:`89536`.)


C API Changes
=============
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CPython now uses the ThinLTO option as the default policy if the Clang
compiler accepts the flag. Patch by Dong-hee Na.
82 changes: 79 additions & 3 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions configure.ac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1863,8 +1863,15 @@ if test "$Py_LTO" = 'true' ; then
# Any changes made here should be reflected in the GCC+Darwin case below
if test $Py_LTO_POLICY = default
then
LTOFLAGS="-flto -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
LTOCFLAGS="-flto"
# Check that ThinLTO is accepted.
AX_CHECK_COMPILE_FLAG([-flto=thin],[
LTOFLAGS="-flto=thin -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
LTOCFLAGS="-flto=thin"
],[
LTOFLAGS="-flto -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
LTOCFLAGS="-flto"
]
)
else
LTOFLAGS="-flto=${Py_LTO_POLICY} -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
LTOCFLAGS="-flto=${Py_LTO_POLICY}"
Expand All @@ -1873,7 +1880,8 @@ if test "$Py_LTO" = 'true' ; then
*)
if test $Py_LTO_POLICY = default
then
LTOFLAGS="-flto"
# Check that ThinLTO is accepted
AX_CHECK_COMPILE_FLAG([-flto=thin],[LTOFLAGS="-flto=thin"],[LTOFLAGS="-flto"])
else
LTOFLAGS="-flto=${Py_LTO_POLICY}"
fi
Expand Down

Back | FazBrowse Home | New Git URL