Skip to content

Commit 0a1b07f

Browse files
committed
pythongh-148535: Don't use gcc -fprofile-update=atomic flag on i686
The -fprofile-update=atomic flag was added to fix a random GCC internal error on PGO build (pythongh-145801) caused by corruption of profile data (.gcda files). The problem is that it makes the PGO build way slower (up to 47x slower) on i686. Since the GCC internal error was not seen on i686 so far, don't use -fprofile-update=atomic on i686.
1 parent 21da9d7 commit 0a1b07f

3 files changed

Lines changed: 88 additions & 7 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
No longer use the ``gcc -fprofile-update=atomic`` flag on i686. The flag has
2+
been added to fix a random GCC internal error on PGO build (:gh:`145801`)
3+
caused by corruption of profile data (.gcda files). The problem is that it
4+
makes the PGO build way slower (up to 47x slower) on i686. Since the GCC
5+
internal error was not seen on i686 so far, don't use
6+
``-fprofile-update=atomic`` on i686 anymore. Patch by Victor Stinner.

configure

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

configure.ac

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,10 +2090,32 @@ case "$ac_cv_cc_name" in
20902090
fi
20912091
;;
20922092
gcc)
2093-
AX_CHECK_COMPILE_FLAG(
2094-
[-fprofile-update=atomic],
2095-
[PGO_PROF_GEN_FLAG="-fprofile-generate -fprofile-update=atomic"],
2096-
[PGO_PROF_GEN_FLAG="-fprofile-generate"])
2093+
# Check for 32-bit x86 ISA
2094+
AC_CACHE_CHECK([for i686], [ac_cv_i686], [
2095+
AC_COMPILE_IFELSE([
2096+
AC_LANG_PROGRAM([
2097+
#ifdef __i386__
2098+
# error "i386"
2099+
#endif
2100+
], [])
2101+
],[ac_cv_i686=no],[ac_cv_i686=yes])
2102+
])
2103+
2104+
PGO_PROF_GEN_FLAG="-fprofile-generate"
2105+
2106+
# Use -fprofile-update=atomic to fix a random GCC internal error on PGO
2107+
# build (gh-145801) caused by corruption of profile data (.gcda files).
2108+
#
2109+
# gh-148535: On i686, using -fprofile-update=atomic makes the PGO build
2110+
# way slower (up to 47x slower). So far, the GCC internal error on PGO
2111+
# build (gh-145801) was not seen on i686, so don't use this flag on i686.
2112+
AS_VAR_IF([ac_cv_i686], [no], [
2113+
AX_CHECK_COMPILE_FLAG(
2114+
[-fprofile-update=atomic],
2115+
[PGO_PROF_GEN_FLAG="$PGO_PROF_GEN_FLAG -fprofile-update=atomic"],
2116+
[])
2117+
])
2118+
20972119
PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
20982120
LLVM_PROF_MERGER="true"
20992121
LLVM_PROF_FILE=""

0 commit comments

Comments
 (0)