Skip to content

Commit e34321a

Browse files
committed
Make -fprofile-update=atomic opt-in for PGO builds to avoid 34% slowdown
1 parent bfd774d commit e34321a

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

configure.ac

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,12 +2130,19 @@ case "$ac_cv_cc_name" in
21302130
# gh-148535: On i686, using -fprofile-update=atomic makes the PGO build
21312131
# way slower (up to 47x slower). So far, the GCC internal error on PGO
21322132
# build was not seen on i686, so don't use this flag on i686.
2133-
AS_VAR_IF([ac_cv_i686], [no], [
2134-
AX_CHECK_COMPILE_FLAG(
2135-
[-fprofile-update=atomic],
2136-
[PGO_PROF_GEN_FLAG="$PGO_PROF_GEN_FLAG -fprofile-update=atomic"],
2137-
[])
2138-
])
2133+
#
2134+
# gh-148535: On x86_64, -fprofile-update=atomic causes severe lock contention,
2135+
# making the PGO build 34% slower on multi-core systems. It is now opt-in.
2136+
AC_ARG_ENABLE([pgo-atomic],
2137+
[AS_HELP_STRING([--enable-pgo-atomic], [Use -fprofile-update=atomic during PGO builds])],
2138+
[PGO_PROF_ATOMIC="-fprofile-update=atomic"],
2139+
[PGO_PROF_ATOMIC=""])
2140+
AS_VAR_IF([ac_cv_i686], [no], [
2141+
AX_CHECK_COMPILE_FLAG(
2142+
[-fprofile-update=atomic],
2143+
[PGO_PROF_GEN_FLAG="$PGO_PROF_GEN_FLAG $PGO_PROF_ATOMIC"],
2144+
[])
2145+
])
21392146

21402147
PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
21412148
LLVM_PROF_MERGER="true"

0 commit comments

Comments
 (0)