summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-07-19 09:32:52 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-07-19 09:32:52 -0700
commitd37b2991b1edea76c01ec05cc383005b55c96e36 (patch)
tree84981b73f1de1fb6ff924059da0c1d77e3d6ccdd
parentMerge branch 'js/rebase-typo-branch-squelch-usage' (diff)
parentAdd explanation of the profile feedback build to the README (diff)
downloadtgif-d37b2991b1edea76c01ec05cc383005b55c96e36.tar.xz
Merge branch 'ak/gcc46-profile-feedback'
* ak/gcc46-profile-feedback: Add explanation of the profile feedback build to the README Add profile feedback build to git Add option to disable NORETURN
-rw-r--r--INSTALL13
-rw-r--r--Makefile22
-rw-r--r--git-compat-util.h2
3 files changed, 36 insertions, 1 deletions
diff --git a/INSTALL b/INSTALL
index 16e45f114f..bbb9d4dc9a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -25,6 +25,19 @@ set up install paths (via config.mak.autogen), so you can write instead
$ make all doc ;# as yourself
# make install install-doc install-html;# as root
+If you're willing to trade off (much) longer build time for a later
+faster git you can also do a profile feedback build with
+
+ $ make profile-all
+ # make prefix=... install
+
+This will run the complete test suite as training workload and then
+rebuild git with the generated profile feedback. This results in a git
+which is a few percent faster on CPU intensive workloads. This
+may be a good tradeoff for distribution packagers.
+
+Note that the profile feedback build stage currently generates
+a lot of additional compiler warnings.
Issues of note:
diff --git a/Makefile b/Makefile
index 46793d1112..4ed7996f7b 100644
--- a/Makefile
+++ b/Makefile
@@ -153,6 +153,9 @@ all::
# that tells runtime paths to dynamic libraries;
# "-Wl,-rpath=/path/lib" is used instead.
#
+# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
+# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
+#
# Define USE_NSEC below if you want git to care about sub-second file mtimes
# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
@@ -1378,6 +1381,9 @@ endif
ifdef USE_ST_TIMESPEC
BASIC_CFLAGS += -DUSE_ST_TIMESPEC
endif
+ifdef NO_NORETURN
+ BASIC_CFLAGS += -DNO_NORETURN
+endif
ifdef NO_NSEC
BASIC_CFLAGS += -DNO_NSEC
endif
@@ -2499,3 +2505,19 @@ cover_db: coverage-report
cover_db_html: cover_db
cover -report html -outputdir cover_db_html cover_db
+
+### profile feedback build
+#
+.PHONY: profile-all profile-clean
+
+PROFILE_GEN_CFLAGS := $(CFLAGS) -fprofile-generate -DNO_NORETURN=1
+PROFILE_USE_CFLAGS := $(CFLAGS) -fprofile-use -fprofile-correction -DNO_NORETURN=1
+
+profile-clean:
+ $(RM) $(addsuffix *.gcda,$(object_dirs))
+ $(RM) $(addsuffix *.gcno,$(object_dirs))
+
+profile-all: profile-clean
+ $(MAKE) CFLAGS="$(PROFILE_GEN_CFLAGS)" all
+ $(MAKE) CFLAGS="$(PROFILE_GEN_CFLAGS)" -j1 test
+ $(MAKE) CFLAGS="$(PROFILE_USE_CFLAGS)" all
diff --git a/git-compat-util.h b/git-compat-util.h
index a75530df7b..ddfbf77149 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -222,7 +222,7 @@ extern char *gitbasename(char *);
#if __HP_cc >= 61000
#define NORETURN __attribute__((noreturn))
#define NORETURN_PTR
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && !defined(NO_NORETURN)
#define NORETURN __attribute__((__noreturn__))
#define NORETURN_PTR __attribute__((__noreturn__))
#elif defined(_MSC_VER)