Bug 1557785 - Fix automatic setting of LTO with clang-cl; r=dmajor

With clang-cl and PGO enabled, toolchain.configure automatically turns
on LTO for compatibility with MSVC. However, MOZ_PGO is set for both the
profile-generate and profile-use builds in a 3-tier PGO setup via
imply_option(), but we only want LTO enabled for the profile-use build
(see bug 1483778).

For 1-tier PGO builds, which are still used by local developers, MOZ_PGO
will be set and --enable-profile-generate will be unset, so LTO will be
automatically enabled. The profiledbuild target in make is responsible
for disabling MOZ_LTO on the profile-generate build.

For 3-tier PGO builds, MOZ_PGO will still be set, so we can skip setting
LTO in configure when --enable-profile-generate is set.

Differential Revision: https://phabricator.services.mozilla.com/D34800

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Shal 2019-06-25 18:38:15 +00:00
Родитель 628c15f57c
Коммит 9ea52410d9
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -1520,16 +1520,16 @@ js_option('--enable-lto',
help='Enable LTO')
@depends('--enable-lto', 'MOZ_PGO', c_compiler)
@depends('--enable-lto', 'MOZ_PGO', '--enable-profile-generate', c_compiler)
@imports('multiprocessing')
def lto(value, pgo, c_compiler):
def lto(value, pgo, profile_generate, c_compiler):
cflags = []
ldflags = []
enabled = None
rust_lto = False
# MSVC's implementation of PGO implies LTO. Make clang-cl match this.
if c_compiler.type == 'clang-cl' and pgo and value.origin == 'default':
if c_compiler.type == 'clang-cl' and pgo and not profile_generate and value.origin == 'default':
value = ['thin']
if value: