From 277d7ee0c95456a21ef371aa025791cbef883169 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Thu, 23 Jun 2016 14:34:16 +0000 Subject: Add make autoprofiledbootstrap Add support for profiledbootstrap with autofdo. Will be useful to get better testing coverage of autofdo. This requires Linux perf and autofdo to be installed, only really for x86_64 linux on Intel so far. Profile the whole build process with perf, then convert the file, and pass it back to the compiler in the feedback stage. The conversion has to be done per language, as only that knows the name of the binary. Currently we only do it for C and C++, as the other languages don't have enough coverage during a normal bootstrap. For lto1 it is also disabled, because it would only be useful during a LTO bootstrap, but right now autofdo and LTO are not working together due to PR66229 For common backend files always the profile output of the C++ compiler is used. In theory multiple inputs could be merged here, but so far that is not implemented. The method is not friendly to partial rebuilds, as only the profile information from the current rebuild is used. So if an error occurs it is best to clean and restart, otherwise the code quality may be worse. This patch is fairly large, but most of it is auto generated from autogen in Makefile.in. for the new stage targets. Passes profiledbootstrap and normal bootstrap on x86_64-linux. autoprofiledbootstrap is currently not working due to PR70427 (but it finishes with that worked around) The autofdo'ed compiler is ~7% faster on insn-recog.i (vs ~11% for profiledfeedback), and ~4% faster for tramp3d-v4 (vs 10% for profiledfeedback) on a Sandy Bridge system. gcc/lto/: 2016-06-23 Andi Kleen * Make-lang.in: Add support for autofdo (disabled for now) gcc/cp/: 2016-06-23 Andi Kleen * Make-lang.in: Add support for autofdo. gcc/: 2016-06-23 Andi Kleen * Makefile.in: Regenerate. * doc/install.texi: Document autoprofiledbootstrap. /: 2016-06-23 Andi Kleen * Makefile.def: Add autoprofiledbootstrap. * Makefile.tpl: Dito. * Makefile.in: Regenerate. gcc/c/: 2016-06-23 Andi Kleen * Make-lang.in: Add support for autofdo. From-SVN: r237733 --- gcc/c/ChangeLog | 4 ++++ gcc/c/Make-lang.in | 14 ++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 47d1f57..dc6cecc 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,7 @@ +2016-06-23 Andi Kleen + + * Make-lang.in: Add support for autofdo. + 2016-06-22 David Malcolm PR c/70339 diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in index 34c8b0e..5b14ba3 100644 --- a/gcc/c/Make-lang.in +++ b/gcc/c/Make-lang.in @@ -60,6 +60,11 @@ c_OBJS = $(C_OBJS) cc1-checksum.o c/gccspec.o # Use strict warnings for this front end. c-warn = $(STRICT_WARN) +ifeq ($(shell cat ../stage_current),stageautofeedback) +$(C_OBJS): ALL_COMPILERFLAGS += -fauto-profile=cc1.fda +$(C_OBJS): cc1.fda +endif + # compute checksum over all object files and the options # re-use the checksum from the prev-final stage so it passes # the bootstrap comparison and allows comparing of the cc1 binary @@ -77,6 +82,10 @@ cc1-checksum.c : build/genchecksum$(build_exeext) checksum-options \ cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \ cc1-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS) + +cc1.fda: ../stage1-gcc/cc1$(exeext) ../prev-gcc/$(PERF_DATA) + $(CREATE_GCOV) -binary ../stage1-gcc/cc1$(exeext) -gcov cc1.fda -profile ../prev-gcc/$(PERF_DATA) -gcov_version 1 + # # Build hooks: @@ -126,6 +135,7 @@ c.mostlyclean: -rm -f cc1$(exeext) -rm -f c/*$(objext) -rm -f c/*$(coverageexts) + -rm -f cc1.fda c.clean: c.distclean: -rm -f c/config.status c/Makefile @@ -146,3 +156,7 @@ c.stageprofile: stageprofile-start -mv c/*$(objext) stageprofile/c c.stagefeedback: stagefeedback-start -mv c/*$(objext) stagefeedback/c +c.autostageprofile: autostageprofile-start + -mv c/*$(objext) autostageprofile/c +c.autostagefeedback: autostagefeedback-start + -mv c/*$(objext) autostagefeedback/c -- cgit v1.1