зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1464170 - Support PGO in clang builds on Linux. r=dmajor
This uses the same code path as for clang-cl builds.
This commit is contained in:
Родитель
601f45564e
Коммит
6d4eb0a92e
18
Makefile.in
18
Makefile.in
|
@ -304,26 +304,24 @@ package-generated-sources:
|
|||
|
||||
#XXX: this is a hack, since we don't want to clobber for MSVC
|
||||
# PGO support, but we can't do this test in client.mk
|
||||
ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
|
||||
# No point in clobbering if PGO has been explicitly disabled.
|
||||
ifndef NO_PROFILE_GUIDED_OPTIMIZE
|
||||
maybe_clobber_profiledbuild: clean
|
||||
else
|
||||
ifdef NO_PROFILE_GUIDED_OPTIMIZE
|
||||
maybe_clobber_profiledbuild:
|
||||
endif
|
||||
else
|
||||
ifdef CLANG_CL
|
||||
ifneq ($(CC_TYPE),msvc)
|
||||
maybe_clobber_profiledbuild: clean
|
||||
# 32-bit PGO is currently blocked by bug 1479800
|
||||
ifeq ($(CPU_ARCH),x86_64)
|
||||
ifneq (,$(findstring clang,$(CC_TYPE)))
|
||||
# 32-bit Windows PGO is currently blocked by bug 1479800
|
||||
ifneq ($(CC_TYPE)_$(CPU_ARCH),clang-cl_x86)
|
||||
$(LLVM_PROFDATA) merge -o $(DEPTH)/merged.profdata $(DEPTH)/*.profraw
|
||||
endif
|
||||
endif
|
||||
else
|
||||
maybe_clobber_profiledbuild:
|
||||
$(RM) $(DIST)/bin/*.pgc
|
||||
find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
|
||||
endif # CLANG_CL
|
||||
endif
|
||||
endif # msvc
|
||||
endif # NO_PROFILE_GUIDED_OPTIMIZE
|
||||
|
||||
.PHONY: maybe_clobber_profiledbuild
|
||||
|
||||
|
|
|
@ -1250,7 +1250,7 @@ def pgo_flags(compiler, build_env, target):
|
|||
if topobjdir.endswith('/js/src'):
|
||||
topobjdir = topobjdir[:-7]
|
||||
|
||||
if compiler.type in ('gcc', 'clang'):
|
||||
if compiler.type == 'gcc':
|
||||
return namespace(
|
||||
gen_cflags=['-fprofile-generate'],
|
||||
gen_ldflags=['-fprofile-generate'],
|
||||
|
@ -1259,18 +1259,26 @@ def pgo_flags(compiler, build_env, target):
|
|||
use_ldflags=['-fprofile-use'],
|
||||
)
|
||||
|
||||
if compiler.type == 'clang-cl':
|
||||
if compiler.type in ('clang-cl', 'clang'):
|
||||
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-out-of-date',
|
||||
'-Wno-error=profile-instr-unprofiled'],
|
||||
use_ldflags=[],
|
||||
)
|
||||
if compiler.type == 'clang-cl':
|
||||
# 32-bit PGO is currently blocked by bug 1479800
|
||||
if target.cpu == 'x86_64':
|
||||
gen_ldflags = ['clang_rt.profile-x86_64.lib']
|
||||
else:
|
||||
gen_ldflags = None
|
||||
else:
|
||||
gen_ldflags = ['-fprofile-instr-generate']
|
||||
|
||||
if gen_ldflags:
|
||||
return namespace(
|
||||
gen_cflags=['-fprofile-instr-generate'],
|
||||
gen_ldflags=gen_ldflags,
|
||||
use_cflags=['-fprofile-instr-use=%s' % profdata,
|
||||
'-Wno-error=profile-instr-out-of-date',
|
||||
'-Wno-error=profile-instr-unprofiled'],
|
||||
use_ldflags=[],
|
||||
)
|
||||
|
||||
if compiler.type == 'msvc':
|
||||
num_cores = min(8, multiprocessing.cpu_count())
|
||||
|
|
Загрузка…
Ссылка в новой задаче