Skip to content

Commit 34c06cc

Browse files
gh-130048: Reintroduce full LTO as default on Clang (GH-130049)
1 parent 1eb3ade commit 34c06cc

File tree

5 files changed

+14
-102
lines changed

5 files changed

+14
-102
lines changed

Doc/using/configure.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@ also be used to improve performance.
575575
.. versionchanged:: 3.12
576576
Use ThinLTO as the default optimization policy on Clang if the compiler accepts the flag.
577577

578+
.. versionchanged:: next
579+
Revert to using full LTO as the default optimization policy on Clang.
580+
578581
.. option:: --enable-bolt
579582

580583
Enable usage of the `BOLT post-link binary optimizer

Doc/whatsnew/3.14.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,10 @@ Build changes
12791279
* GNU Autoconf 2.72 is now required to generate :file:`configure`.
12801280
(Contributed by Erlend Aasland in :gh:`115765`.)
12811281

1282+
* CPython now uses Full LTO as the default link time optimization policy
1283+
on Clang. This reverts an earlier change in CPython 3.12.
1284+
(Contributed by Ken Jin in :gh:`130049`.)
1285+
12821286
.. _whatsnew314-pep761:
12831287

12841288
PEP 761: Discontinuation of PGP signatures
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CPython now uses Full LTO as the default link time optimization policy on Clang. This reverts an earlier change in CPython 3.12.

configure

Lines changed: 3 additions & 91 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,15 +1986,8 @@ if test "$Py_LTO" = 'true' ; then
19861986
# Any changes made here should be reflected in the GCC+Darwin case below
19871987
if test $Py_LTO_POLICY = default
19881988
then
1989-
# Check that ThinLTO is accepted.
1990-
AX_CHECK_COMPILE_FLAG([-flto=thin],[
1991-
LTOFLAGS="-flto=thin -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
1992-
LTOCFLAGS="-flto=thin"
1993-
],[
1994-
LTOFLAGS="-flto -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
1995-
LTOCFLAGS="-flto"
1996-
]
1997-
)
1989+
LTOFLAGS="-flto -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
1990+
LTOCFLAGS="-flto"
19981991
else
19991992
LTOFLAGS="-flto=${Py_LTO_POLICY} -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto"
20001993
LTOCFLAGS="-flto=${Py_LTO_POLICY}"
@@ -2003,8 +1996,7 @@ if test "$Py_LTO" = 'true' ; then
20031996
*)
20041997
if test $Py_LTO_POLICY = default
20051998
then
2006-
# Check that ThinLTO is accepted
2007-
AX_CHECK_COMPILE_FLAG([-flto=thin],[LTOFLAGS="-flto=thin"],[LTOFLAGS="-flto"])
1999+
LTOFLAGS="-flto"
20082000
else
20092001
LTOFLAGS="-flto=${Py_LTO_POLICY}"
20102002
fi

0 commit comments

Comments
 (0)