Bug 1519012 - Move most PGO-related configure flags back to toolchain.configure. r=froydnj

LLVM_PROFDATA needs the toolchain search dir, per bug 1515579.

Also, most of the options actually don't do anything useful with
artifact builds. In fact, the only one that artifact builds would need
is MOZ_PGO. So we move to options back to toolchain.configure, somewhere
late enough ; except MOZ_PGO, that we move to the top-level
moz.configure (because we don't need a separate file for one option).

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-01-10 14:25:12 +00:00
Родитель 4ba731a175
Коммит 8153f29959
3 изменённых файлов: 56 добавлений и 60 удалений

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

@ -1,58 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
llvm_profdata = check_prog('LLVM_PROFDATA', ['llvm-profdata'],
allow_missing=True)
add_old_configure_assignment('LLVM_PROFDATA', llvm_profdata)
# PGO
# ==============================================================
js_option('--enable-profile-generate',
help='Build a PGO instrumented binary')
imply_option('MOZ_PGO',
depends_if('--enable-profile-generate')(lambda _: True))
set_config('MOZ_PROFILE_GENERATE',
depends_if('--enable-profile-generate')(lambda _: True))
js_option('--enable-profile-use',
help='Use a generated profile during the build')
js_option('--with-pgo-profile-path',
help='Path to the (unmerged) profile path to use during the build',
nargs=1)
imply_option('MOZ_PGO',
depends_if('--enable-profile-use')(lambda _: True))
set_config('MOZ_PROFILE_USE',
depends_if('--enable-profile-use')(lambda _: True))
js_option(env='MOZ_PGO', help='Build with profile guided optimizations')
set_config('MOZ_PGO', depends('MOZ_PGO')(lambda x: bool(x)))
add_old_configure_assignment('MOZ_PGO', depends('MOZ_PGO')(lambda x: bool(x)))
@depends('--with-pgo-profile-path', '--enable-profile-use', 'LLVM_PROFDATA')
def pgo_profile_path(path, pgo_use, profdata):
if not path:
return
if path and not pgo_use:
die('Pass --enable-profile-use to use --with-pgo-profile-path.')
if path and not profdata:
die('LLVM_PROFDATA must be set to process the pgo profile.')
return path[0]
set_config('PGO_PROFILE_PATH', pgo_profile_path)
option('--with-pgo-jarlog',
help='Use the provided jarlog file when packaging during a profile-use '
'build',
nargs=1)
set_config('PGO_JARLOG_PATH', depends_if('--with-pgo-jarlog')(lambda p: p))

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

@ -22,7 +22,6 @@ def developer_options(value):
add_old_configure_assignment('DEVELOPER_OPTIONS', developer_options)
set_config('DEVELOPER_OPTIONS', developer_options)
# Code optimization
# ==============================================================
@ -1482,6 +1481,57 @@ def is_windows(target, host):
include('windows.configure', when=is_windows)
# PGO
# ==============================================================
llvm_profdata = check_prog('LLVM_PROFDATA', ['llvm-profdata'],
allow_missing=True)
add_old_configure_assignment('LLVM_PROFDATA', llvm_profdata)
js_option('--enable-profile-generate',
help='Build a PGO instrumented binary')
imply_option('MOZ_PGO',
depends_if('--enable-profile-generate')(lambda _: True))
set_config('MOZ_PROFILE_GENERATE',
depends_if('--enable-profile-generate')(lambda _: True))
js_option('--enable-profile-use',
help='Use a generated profile during the build')
js_option('--with-pgo-profile-path',
help='Path to the (unmerged) profile path to use during the build',
nargs=1)
imply_option('MOZ_PGO',
depends_if('--enable-profile-use')(lambda _: True))
set_config('MOZ_PROFILE_USE',
depends_if('--enable-profile-use')(lambda _: True))
@depends('--with-pgo-profile-path', '--enable-profile-use', 'LLVM_PROFDATA')
def pgo_profile_path(path, pgo_use, profdata):
if not path:
return
if path and not pgo_use:
die('Pass --enable-profile-use to use --with-pgo-profile-path.')
if path and not profdata:
die('LLVM_PROFDATA must be set to process the pgo profile.')
return path[0]
set_config('PGO_PROFILE_PATH', pgo_profile_path)
option('--with-pgo-jarlog',
help='Use the provided jarlog file when packaging during a profile-use '
'build',
nargs=1)
set_config('PGO_JARLOG_PATH', depends_if('--with-pgo-jarlog')(lambda p: p))
# LTO
# ==============================================================

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

@ -119,7 +119,11 @@ def debug_rust():
set_config('MOZ_DEBUG_RUST', debug_rust)
set_define('MOZ_DEBUG_RUST', debug_rust)
include('build/moz.configure/pgo.configure')
js_option(env='MOZ_PGO', help='Build with profile guided optimizations')
set_config('MOZ_PGO', depends('MOZ_PGO')(lambda x: bool(x)))
add_old_configure_assignment('MOZ_PGO', depends('MOZ_PGO')(lambda x: bool(x)))
include('build/moz.configure/pkg.configure')
# Make this assignment here rather than in pkg.configure to avoid
# requiring this file in unit tests.