Bug 1542746 - switch clang{,-cl} to use IR-based instrumentation for PGO; r=firefox-build-system-reviewers,chmanchester
authorNathan Froyd <froydnj@mozilla.com>
Fri, 24 May 2019 19:52:41 +0000
changeset 475464 bd7bac95cd92ff936212b0243c993f920720771e
parent 475463 13461d98a55fe4a7e7bf492b9812418c548c6a85
child 475465 085342ba416f464742b068edd32f20fae8e18e87
push id36062
push useraciure@mozilla.com
push dateSat, 25 May 2019 09:39:13 +0000
treeherdermozilla-central@af54b2de7028 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, chmanchester
bugs1542746
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 1542746 - switch clang{,-cl} to use IR-based instrumentation for PGO; r=firefox-build-system-reviewers,chmanchester This form of instrumentation is more like our other platforms, and also opens the possibility of interacting properly with Rust IR-level PGO. Differential Revision: https://phabricator.services.mozilla.com/D31133
build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1396,33 +1396,36 @@ def pgo_flags(compiler, build_env, targe
             gen_ldflags=['-fprofile-generate'],
             use_cflags=['-fprofile-use', '-fprofile-correction',
                         '-Wcoverage-mismatch'],
             use_ldflags=['-fprofile-use'],
         )
 
     if compiler.type in ('clang-cl', 'clang'):
         profdata = os.path.join(topobjdir, 'merged.profdata')
+        prefix = ''
         if compiler.type == 'clang-cl':
+            prefix = '/clang:'
             if target.cpu == 'x86_64':
                 gen_ldflags = ['clang_rt.profile-x86_64.lib']
             elif target.cpu == 'x86':
                 gen_ldflags = ['clang_rt.profile-i386.lib']
             else:
                 gen_ldflags = None
         else:
-            gen_ldflags = ['-fprofile-instr-generate']
+            gen_ldflags = ['-fprofile-generate']
 
         if gen_ldflags:
             return namespace(
-                gen_cflags=['-fprofile-instr-generate'],
+                gen_cflags=[prefix + '-fprofile-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_cflags=[prefix + '-fprofile-use=%s' % profdata,
+                            # Some error messages about mismatched profile data
+                            # come in via -Wbackend-plugin, so disable those too.
+                            '-Wno-error=backend-plugin'],
                 use_ldflags=[],
             )
 
 
 set_config('PROFILE_GEN_CFLAGS', pgo_flags.gen_cflags)
 set_config('PROFILE_GEN_LDFLAGS', pgo_flags.gen_ldflags)
 set_config('PROFILE_USE_CFLAGS', pgo_flags.use_cflags)
 set_config('PROFILE_USE_LDFLAGS', pgo_flags.use_ldflags)