aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/Makefile.in9
-rw-r--r--gcc/c/ChangeLog4
-rw-r--r--gcc/c/Make-lang.in14
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/Make-lang.in14
-rw-r--r--gcc/doc/install.texi11
-rw-r--r--gcc/lto/ChangeLog4
-rw-r--r--gcc/lto/Make-lang.in14
9 files changed, 76 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 84df8a7..9a1f732 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2016-06-23 Andi Kleen <ak@linux.intel.com>
+ * Makefile.in: Regenerate.
+ * doc/install.texi: Document autoprofiledbootstrap.
+
+2016-06-23 Andi Kleen <ak@linux.intel.com>
+
* config/i386/gcc-auto-profile: New file.
2016-06-23 Martin Liska <mliska@suse.cz>
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 776f6d7..878fcd0 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1567,6 +1567,13 @@ ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \
$(GCOV_TOOL_OBJS) $(GENGTYPE_OBJS) gcc-ar.o gcc-nm.o gcc-ranlib.o \
lto-wrapper.o collect-utils.o
+# for anything that is shared use the cc1plus profile data, as that
+# is likely the most exercised during the build
+ifeq ($(shell cat ../stage_current),stageautofeedback)
+$(ALL_HOST_BACKEND_OBJS): ALL_COMPILERFLAGS += -fauto-profile=cc1plus.fda
+$(ALL_HOST_BACKEND_OBJS): cc1plus.fda
+endif
+
# This lists all host object files, whether they are included in this
# compilation or not.
ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS)
@@ -1596,7 +1603,7 @@ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
gcov-iov$(build_exeext) gcov$(exeext) gcov-dump$(exeext) \
gcov-tool$(exeect) \
gengtype$(exeext) *.[0-9][0-9].* *.[si] *-checksum.c libbackend.a \
- libcommon-target.a libcommon.a libgcc.mk
+ libcommon-target.a libcommon.a libgcc.mk perf.data
# This symlink makes the full installation name of the driver be available
# from within the *build* directory, for use when running the JIT library
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 <ak@linux.intel.com>
+
+ * Make-lang.in: Add support for autofdo.
+
2016-06-22 David Malcolm <dmalcolm@redhat.com>
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
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 20e34d6..9ef7d4e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2016-06-23 Andi Kleen <ak@linux.intel.com>
+
+ * Make-lang.in: Add support for autofdo.
+
2016-06-21 Jason Merrill <jason@redhat.com>
* constraint.cc (constraints_satisfied_p): Keep as many levels of
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 625a77c..c1f26ea 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -81,6 +81,11 @@ CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
cp/vtable-class-hierarchy.o cp/constexpr.o cp/cp-ubsan.o \
cp/constraint.o cp/logic.o $(CXX_C_OBJS)
+ifeq ($(shell cat ../stage_current),stageautofeedback)
+$(CXX_AND_OBJCXX_OBJS): CFLAGS += -fauto-profile=cc1plus.fda
+$(CXX_AND_OBJCXX_OBJS): cc1plus.fda
+endif
+
# Language-specific object files for C++.
CXX_OBJS = cp/cp-lang.o c-family/stub-objc.o $(CXX_AND_OBJCXX_OBJS)
@@ -122,6 +127,9 @@ endif
gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
$(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
+cc1plus.fda: ../stage1-gcc/cc1plus$(exeext) ../prev-gcc/$(PERF_DATA)
+ $(CREATE_GCOV) -binary ../stage1-gcc/cc1plus$(exeext) -gcov cc1plus.fda -profile ../prev-gcc/$(PERF_DATA) -gcov_version 1
+
#
# Build hooks:
@@ -235,7 +243,7 @@ c++.mostlyclean:
-rm -f doc/g++.1
-rm -f cp/*$(objext)
-rm -f cp/*$(coverageexts)
- -rm -f xg++$(exeext) g++-cross$(exeext) cc1plus$(exeext)
+ -rm -f xg++$(exeext) g++-cross$(exeext) cc1plus$(exeext) cc1plus.fda
c++.clean:
c++.distclean:
-rm -f cp/config.status cp/Makefile
@@ -257,3 +265,7 @@ c++.stageprofile: stageprofile-start
-mv cp/*$(objext) stageprofile/cp
c++.stagefeedback: stagefeedback-start
-mv cp/*$(objext) stagefeedback/cp
+c++.autostageprofile: stageprofile-start
+ -mv cp/*$(objext) autostageprofile/cp
+c++.autostagefeedback: stagefeedback-start
+ -mv cp/*$(objext) autostagefeedback/cp
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 3015de8..9248f0d 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2776,6 +2776,17 @@ Unlike standard bootstrap, several additional restrictions apply. The
compiler used to build @code{stage1} needs to support a 64-bit integral type.
It is recommended to only use GCC for this.
+On Linux/x86_64 hosts with some restrictions (no virtualization) it is
+also possible to do autofdo build with @samp{make
+autoprofiledback}. This uses Linux perf to sample branches in the
+binary and then rebuild it with feedback derived from the profile.
+Linux perf and the @code{autofdo} toolkit needs to be installed for
+this.
+
+Only the profile from the current build is used, so when an error
+occurs it is recommended to clean before restarting. Otherwise
+the code quality may be much worse.
+
@html
<hr />
<p>
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 9323a255..f2e56a9 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,7 @@
+2016-06-23 Andi Kleen <ak@linux.intel.com>
+
+ * Make-lang.in: Add support for autofdo (disabled for now)
+
2016-06-10 Martin Sebor <msebor@redhat.com>
PR c/71392
diff --git a/gcc/lto/Make-lang.in b/gcc/lto/Make-lang.in
index 28fe675..9b95276 100644
--- a/gcc/lto/Make-lang.in
+++ b/gcc/lto/Make-lang.in
@@ -25,6 +25,15 @@ LTO_EXE = lto1$(exeext)
LTO_OBJS = lto/lto-lang.o lto/lto.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o
lto_OBJS = $(LTO_OBJS)
+# this is only useful in a LTO bootstrap, but this does not work right
+# now. Should reenable after this is fixed, but only when LTO bootstrap
+# is enabled.
+
+#ifeq ($(shell cat ../stage_current),stageautofeedback)
+#$(LTO_OBJS): CFLAGS += -fauto-profile=lto1.fda
+#$(LTO_OBJS): lto1.fda
+#endif
+
# Rules
# These hooks are used by the main GCC Makefile. Consult that
@@ -50,7 +59,7 @@ lto.srcinfo:
lto.install-plugin:
lto.mostlyclean:
- rm -f $(LTO_OBJS) $(LTO_EXE)
+ rm -f $(LTO_OBJS) $(LTO_EXE) lto1.fda
lto.clean:
lto.distclean:
@@ -71,5 +80,8 @@ $(LTO_EXE): $(LTO_OBJS) $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(LTO_OBJS) $(BACKEND) $(BACKENDLIBS) $(LIBS)
+lto1.fda: ../prev-gcc/lto1$(exeext) ../prev-gcc/$(PERF_DATA)
+ $(CREATE_GCOV) -binary ../prev-gcc/lto1$(exeext) -gcov lto1.fda -profile ../prev-gcc/$(PERF_DATA) -gcov_version 1
+
# LTO testing is done as part of C/C++/Fortran etc. testing.
check-lto: