Skip to content

Commit 53e0725

Browse files
authored
[3.13] gh-148535: Don't use gcc -fprofile-update=atomic flag on i686 (#148554) (#148656)
gh-148535: Don't use gcc -fprofile-update=atomic flag on i686 (#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)
1 parent 9c2db81 commit 53e0725

File tree

3 files changed

+86
-7
lines changed

3 files changed

+86
-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: 54 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
@@ -2137,10 +2137,32 @@ case "$CC_BASENAME" in
21372137
fi
21382138
;;
21392139
*)
2140-
AX_CHECK_COMPILE_FLAG(
2141-
[-fprofile-update=atomic],
2142-
[PGO_PROF_GEN_FLAG="-fprofile-generate -fprofile-update=atomic"],
2143-
[PGO_PROF_GEN_FLAG="-fprofile-generate"])
2140+
# Check for 32-bit x86 ISA
2141+
AC_CACHE_CHECK([for i686], [ac_cv_i686], [
2142+
AC_COMPILE_IFELSE([
2143+
AC_LANG_PROGRAM([
2144+
#ifdef __i386__
2145+
# error "i386"
2146+
#endif
2147+
], [])
2148+
],[ac_cv_i686=no],[ac_cv_i686=yes])
2149+
])
2150+
2151+
PGO_PROF_GEN_FLAG="-fprofile-generate"
2152+
2153+
# Use -fprofile-update=atomic to fix a random GCC internal error on PGO
2154+
# build (gh-145801) caused by corruption of profile data (.gcda files).
2155+
#
2156+
# gh-148535: On i686, using -fprofile-update=atomic makes the PGO build
2157+
# way slower (up to 47x slower). So far, the GCC internal error on PGO
2158+
# build was not seen on i686, so don't use this flag on i686.
2159+
AS_VAR_IF([ac_cv_i686], [no], [
2160+
AX_CHECK_COMPILE_FLAG(
2161+
[-fprofile-update=atomic],
2162+
[PGO_PROF_GEN_FLAG="$PGO_PROF_GEN_FLAG -fprofile-update=atomic"],
2163+
[])
2164+
])
2165+
21442166
PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
21452167
LLVM_PROF_MERGER="true"
21462168
LLVM_PROF_FILE=""

0 commit comments

Comments
 (0)