Skip to content
Commits on Feb 6, 2012
  1. @tytso @gitster

    Fix build problems related to profile-directed optimization

    tytso committed with gitster
    There was a number of problems I ran into when trying the
    profile-directed optimizations added by Andi Kleen in git commit
    7ddc271.  (This was using gcc 4.4 found on many enterprise
    distros.)
    
    1) The -fprofile-generate and -fprofile-use commands are incompatible
    with ccache; the code ends up looking in the wrong place for the gcda
    files based on the ccache object names.
    
    2) If the makefile notices that CFLAGS are different, it will rebuild
    all of the binaries.  Hence the recipe originally specified by the
    INSTALL file ("make profile-all" followed by "make install") doesn't
    work.  It will appear to work, but the binaries will end up getting
    built with no optimization.
    
    This patch fixes this by using an explicit set of options passed via
    the PROFILE variable then using this to directly manipulate CFLAGS and
    EXTLIBS.
    
    The developer can run "make PROFILE=BUILD all ; sudo make
    PROFILE=BUILD install" automatically run a two-pass build with the
    test suite run in between as the sample workload for the purpose of
    recording profiling information to do the profile-directed
    optimization.
    
    Alternatively, the profiling version of binaries can be built using:
    
    	make PROFILE=GEN PROFILE_DIR=/var/cache/profile all
    	make PROFILE=GEN install
    
    and then after git has been used for a while, the optimized version of
    the binary can be built as follows:
    
    	make PROFILE=USE PROFILE_DIR=/var/cache/profile all
    	make PROFILE=USE install
    
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Cc: Andi Kleen <ak@linux.intel.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.