Skip to content

Commit 2fdccb3

Browse files
[3.14] gh-148535: Don't use gcc -fprofile-update=atomic flag on i686 (GH-148554) (#148655)
gh-148535: Don't use gcc -fprofile-update=atomic flag on i686 (GH-148554) The -fprofile-update=atomic flag was added to fix a random GCC internal error on PGO build (gh-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. (cherry picked from commit 2faceee) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 1c9de6b commit 2fdccb3

File tree

3 files changed

+88
-7
lines changed

3 files changed

+88
-7
lines changed
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
@@ -2072,10 +2072,32 @@ case "$ac_cv_cc_name" in
20722072
fi
20732073
;;
20742074
gcc)
2075-
AX_CHECK_COMPILE_FLAG(
2076-
[-fprofile-update=atomic],
2077-
[PGO_PROF_GEN_FLAG="-fprofile-generate -fprofile-update=atomic"],
2078-
[PGO_PROF_GEN_FLAG="-fprofile-generate"])
2075+
# Check for 32-bit x86 ISA
2076+
AC_CACHE_CHECK([for i686], [ac_cv_i686], [
2077+
AC_COMPILE_IFELSE([
2078+
AC_LANG_PROGRAM([
2079+
#ifdef __i386__
2080+
# error "i386"
2081+
#endif
2082+
], [])
2083+
],[ac_cv_i686=no],[ac_cv_i686=yes])
2084+
])
2085+
2086+
PGO_PROF_GEN_FLAG="-fprofile-generate"
2087+
2088+
# Use -fprofile-update=atomic to fix a random GCC internal error on PGO
2089+
# build (gh-145801) caused by corruption of profile data (.gcda files).
2090+
#
2091+
# gh-148535: On i686, using -fprofile-update=atomic makes the PGO build
2092+
# way slower (up to 47x slower). So far, the GCC internal error on PGO
2093+
# build was not seen on i686, so don't use this flag on i686.
2094+
AS_VAR_IF([ac_cv_i686], [no], [
2095+
AX_CHECK_COMPILE_FLAG(
2096+
[-fprofile-update=atomic],
2097+
[PGO_PROF_GEN_FLAG="$PGO_PROF_GEN_FLAG -fprofile-update=atomic"],
2098+
[])
2099+
])
2100+
20792101
PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
20802102
LLVM_PROF_MERGER="true"
20812103
LLVM_PROF_FILE=""

0 commit comments

Comments
 (0)