Bug 1557785 - Fix automatic setting of LTO with clang-cl; r=dmajor
authorMike Shal <mshal@mozilla.com>
Tue, 25 Jun 2019 18:38:15 +0000
changeset 480095 b5c65f2ea1acbc7a95a1c57e72464661540ab821
parent 480094 3430c89be449991836d52314869269cc0afa8227
child 480096 861e83cc1b9bc119f70c7a714eb8c9b4d0e3b34c
push id36201
push usercsabou@mozilla.com
push dateWed, 26 Jun 2019 03:57:29 +0000
treeherdermozilla-central@a3cad1d7836c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmajor
bugs1557785, 1483778
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1515,26 +1515,26 @@ set_config('PGO_JARLOG_PATH', depends_if
 
 js_option('--enable-lto',
           env='MOZ_LTO',
           nargs='?',
           choices=('full', 'thin', 'cross'),
           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:
         enabled = True
         # `cross` implies `thin`, but with Rust code participating in LTO
         # as well.  Make that a little more explicit.
         if len(value) and value[0].lower() == 'cross':
             if c_compiler.type == 'gcc':