diff -r 208d6d14c2a3 Makefile.pre.in --- a/Makefile.pre.in Thu Aug 13 21:52:56 2015 -0700 +++ b/Makefile.pre.in Mon Aug 24 16:39:29 2015 +0300 @@ -204,8 +204,7 @@ TCLTK_LIBS= @TCLTK_LIBS@ # The task to run while instrument when building the profile-opt target -PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck -#PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py +PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py # === Definitions added by makesetup === @@ -424,23 +423,29 @@ profile-opt: @echo "Building with support for profile generation:" $(MAKE) clean - $(MAKE) build_all_generate_profile + $(MAKE) profile-removal + $(MAKE) build_all_generate_profile @echo "Running benchmark to generate profile data:" $(MAKE) profile-removal $(MAKE) run_profile_task + $(MAKE) build_all_aggregate_profile @echo "Rebuilding with profile guided optimizations:" $(MAKE) clean $(MAKE) build_all_use_profile + $(MAKE) profile-removal build_all_generate_profile: - $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov" + $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-instr-generate" LDFLAGS="$(LDFLAGS) -fprofile-instr-generate" LIBS="$(LIBS)" run_profile_task: : # FIXME: can't run for a cross build - ./$(BUILDPYTHON) $(PROFILE_TASK) + LLVM_PROFILE_FILE="code-%p.profclangr" ./$(BUILDPYTHON) $(PROFILE_TASK) || true + +build_all_aggregate_profile: + llvm-profdata merge -output=code.profclangd *.profclangr build_all_use_profile: - $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use" + $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-instr-use=code.profclangd" coverage: @echo "Building with support for coverage checking:" @@ -1330,9 +1335,12 @@ find build -name 'fficonfig.h' -exec rm -f {} ';' || true find build -name 'fficonfig.py' -exec rm -f {} ';' || true -rm -f Lib/lib2to3/*Grammar*.pickle - + rm -rf build || true + profile-removal: find . -name '*.gc??' -exec rm -f {} ';' + find . -name '*.profclang?' -exec rm -f {} ';' + clobber: clean profile-removal -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \