зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1341525: Enable PGO in 64-bit clang-cl builds. r=froydnj
This commit is contained in:
Родитель
250fd9a027
Коммит
ebe3264f11
|
@ -314,6 +314,10 @@ endif
|
||||||
else
|
else
|
||||||
ifdef CLANG_CL
|
ifdef CLANG_CL
|
||||||
maybe_clobber_profiledbuild: clean
|
maybe_clobber_profiledbuild: clean
|
||||||
|
# 32-bit PGO is currently blocked by bug 1479800
|
||||||
|
ifeq ($(CPU_ARCH),x86_64)
|
||||||
|
$(LLVM_PROFDATA) merge -o $(DEPTH)/merged.profdata $(DEPTH)/*.profraw
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
maybe_clobber_profiledbuild:
|
maybe_clobber_profiledbuild:
|
||||||
$(RM) $(DIST)/bin/*.pgc
|
$(RM) $(DIST)/bin/*.pgc
|
||||||
|
|
|
@ -1240,10 +1240,14 @@ set_config('WRAP_SYSTEM_INCLUDES', wrap_system_includes)
|
||||||
set_config('VISIBILITY_FLAGS', visibility_flags)
|
set_config('VISIBILITY_FLAGS', visibility_flags)
|
||||||
|
|
||||||
|
|
||||||
@depends(c_compiler)
|
@depends(c_compiler, check_build_environment, target)
|
||||||
@imports('multiprocessing')
|
@imports('multiprocessing')
|
||||||
@imports(_from='__builtin__', _import='min')
|
@imports(_from='__builtin__', _import='min')
|
||||||
def pgo_flags(compiler):
|
def pgo_flags(compiler, build_env, target):
|
||||||
|
topobjdir = build_env.topobjdir
|
||||||
|
if topobjdir.endswith('/js/src'):
|
||||||
|
topobjdir = topobjdir[:-7]
|
||||||
|
|
||||||
if compiler.type in ('gcc', 'clang'):
|
if compiler.type in ('gcc', 'clang'):
|
||||||
return namespace(
|
return namespace(
|
||||||
gen_cflags=['-fprofile-generate'],
|
gen_cflags=['-fprofile-generate'],
|
||||||
|
@ -1253,6 +1257,18 @@ def pgo_flags(compiler):
|
||||||
use_ldflags=['-fprofile-use'],
|
use_ldflags=['-fprofile-use'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if compiler.type == 'clang-cl':
|
||||||
|
profdata = os.path.join(topobjdir, 'merged.profdata')
|
||||||
|
# 32-bit PGO is currently blocked by bug 1479800
|
||||||
|
if target.cpu == 'x86_64':
|
||||||
|
return namespace(
|
||||||
|
gen_cflags=['-fprofile-instr-generate'],
|
||||||
|
gen_ldflags=['clang_rt.profile-x86_64.lib'],
|
||||||
|
use_cflags=['-fprofile-instr-use=%s' % profdata,
|
||||||
|
'-Wno-error=profile-instr-unprofiled'],
|
||||||
|
use_ldflags=[],
|
||||||
|
)
|
||||||
|
|
||||||
if compiler.type == 'msvc':
|
if compiler.type == 'msvc':
|
||||||
num_cores = min(8, multiprocessing.cpu_count())
|
num_cores = min(8, multiprocessing.cpu_count())
|
||||||
cgthreads = '-CGTHREADS:%s' % num_cores
|
cgthreads = '-CGTHREADS:%s' % num_cores
|
||||||
|
@ -1282,6 +1298,11 @@ set_config('PROFILE_GEN_LDFLAGS', pgo_flags.gen_ldflags)
|
||||||
set_config('PROFILE_USE_CFLAGS', pgo_flags.use_cflags)
|
set_config('PROFILE_USE_CFLAGS', pgo_flags.use_cflags)
|
||||||
set_config('PROFILE_USE_LDFLAGS', pgo_flags.use_ldflags)
|
set_config('PROFILE_USE_LDFLAGS', pgo_flags.use_ldflags)
|
||||||
|
|
||||||
|
llvm_profdata = check_prog('LLVM_PROFDATA', ['llvm-profdata'],
|
||||||
|
allow_missing=True)
|
||||||
|
|
||||||
|
add_old_configure_assignment('LLVM_PROFDATA', llvm_profdata)
|
||||||
|
|
||||||
|
|
||||||
@depends(c_compiler)
|
@depends(c_compiler)
|
||||||
def preprocess_option(compiler):
|
def preprocess_option(compiler):
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
if test -d "$topsrcdir/clang/bin"; then
|
if test -d "$topsrcdir/clang/bin"; then
|
||||||
CLANG_DIR=`cd "$topsrcdir/clang/bin" ; pwd`
|
CLANG_DIR=`cd "$topsrcdir/clang/bin" ; pwd`
|
||||||
export PATH="${CLANG_DIR}:${PATH}"
|
export PATH="${CLANG_DIR}:${PATH}"
|
||||||
|
|
||||||
mk_export_correct_style PATH
|
mk_export_correct_style PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -d "$topsrcdir/clang/lib/clang"; then
|
||||||
|
CLANG_LIB_DIR="$(cd $topsrcdir/clang/lib/clang/* && cd lib/windows && pwd)"
|
||||||
|
export LIB=$LIB:$CLANG_LIB_DIR
|
||||||
|
mk_export_correct_style LIB
|
||||||
|
fi
|
||||||
|
|
||||||
export CC=clang-cl
|
export CC=clang-cl
|
||||||
export CXX=clang-cl
|
export CXX=clang-cl
|
||||||
|
|
Загрузка…
Ссылка в новой задаче