Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
When using :option:`--enable-bolt`, enable safe identical code folding on
BOLT versions new enough to support it (LLVM 20+).
59 changes: 58 additions & 1 deletion configure

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

23 changes: 22 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,27 @@ if test "$Py_BOLT" = 'true' ; then
else
AC_MSG_ERROR([merge-fdata is required for a --enable-bolt build but could not be found.])
fi

py_bolt_icf_flag="-icf=safe"
AC_CACHE_CHECK(
[whether ${LLVM_BOLT} supports safe identical code folding],
[py_cv_bolt_icf_safe],
[
WITH_SAVE_ENV([
CFLAGS="$CFLAGS_NODIST"
LDFLAGS="$LDFLAGS_NODIST"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [])],
[py_cv_bolt_icf_safe=no
${LLVM_BOLT} -icf=safe -o conftest.bolt conftest$EXEEXT >&AS_MESSAGE_LOG_FD 2>&1 dnl
&& py_cv_bolt_icf_safe=yes],
[AC_MSG_FAILURE([could not compile empty test program])])
])
]
)
if test "$py_cv_bolt_icf_safe" = no; then
py_bolt_icf_flag=""
fi
fi

dnl Enable BOLT of libpython if built and used by the python3 binary.
Expand Down Expand Up @@ -2289,7 +2310,7 @@ then
-reorder-blocks=ext-tsp
-reorder-functions=cdsort
-split-functions
-icf=0
${py_bolt_icf_flag}
-inline-all
-split-eh
-reorder-functions-use-hot-size
Expand Down
Loading