summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2015-09-18 15:09:42 -0700
committerBrett Cannon <brett@python.org>2015-09-18 15:09:42 -0700
commit4ff151a72a3331c514924a5e0d33747a91413fbd (patch)
tree6a911a48917de5a71557cb5a187281f6e232a1b5 /configure.ac
parent62f0ffa86136f06c84cee139f29aa3b9ad0385a3 (diff)
downloadcpython-git-4ff151a72a3331c514924a5e0d33747a91413fbd.tar.gz
Issue #24915: Make PGO builds support Clang and use the test suite for
profile data. Thanks to Alecsandru Patrascu of Intel for the initial patch.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac45
1 files changed, 45 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 2c998b1ee9..decf0ec742 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1352,6 +1352,51 @@ then
CFLAGS=$save_CFLAGS
fi
+
+# Enable PGO flags.
+AC_SUBST(PGO_PROF_GEN_FLAG)
+AC_SUBST(PGO_PROF_USE_FLAG)
+AC_SUBST(LLVM_PROF_MERGER)
+AC_SUBST(LLVM_PROF_FILE)
+AC_SUBST(LLVM_PROF_ERR)
+AC_SUBST(LLVM_PROF_FOUND)
+AC_CHECK_PROG(LLVM_PROF_FOUND, llvm-profdata, found, not-found)
+LLVM_PROF_ERR=no
+case $CC in
+ *clang*)
+ # Any changes made here should be reflected in the GCC+Darwin case below
+ PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
+ PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
+ LLVM_PROF_MERGER="llvm-profdata merge -output=code.profclangd *.profclangr"
+ LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
+ if test $LLVM_PROF_FOUND = not-found
+ then
+ LLVM_PROF_ERR=yes
+ fi
+ ;;
+ *gcc*)
+ case $ac_sys_system in
+ Darwin*)
+ PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
+ PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
+ LLVM_PROF_MERGER="llvm-profdata merge -output=code.profclangd *.profclangr"
+ LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
+ if test $LLVM_PROF_FOUND = not-found
+ then
+ LLVM_PROF_ERR=yes
+ fi
+ ;;
+ *)
+ PGO_PROF_GEN_FLAG="-fprofile-generate"
+ PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
+ LLVM_PROF_MERGER="true"
+ LLVM_PROF_FILE=""
+ ;;
+ esac
+ ;;
+esac
+
+
# On some compilers, pthreads are available without further options
# (e.g. MacOS X). On some of these systems, the compiler will not
# complain if unaccepted options are passed (e.g. gcc on Mac OS X).