Bug 1619461 - Enable the new pass manager in clang builds. r=rstewart,glandium

LLVM's new pass manager has been in the works for several years and has better optimization (sometimes much better) than the legacy pass manager. I think it's in good enough shape for us to try at this point.

While we only really need the new pass manager for shippable builds, as a general principle I'd like to use it as much as possible, to help catch bugs for upstream. Therefore this patch enables the new pass manager by default for all clang builds, with the only exceptions being compilers older than version 9, and xcode clang where we can't trust the version number. There isn't a specific problem with older versions; I just don't want to sign up for the support cost of debugging people's local builds that may be fixed already.

I don't expect it to be necessary, but just in case, an opt-out is available via `ac_add_options --disable-new-pass-manager`.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
David Major 2020-03-11 02:08:37 +00:00
Родитель 18af17355f
Коммит 21170f3a10
2 изменённых файлов: 21 добавлений и 1 удалений

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

@ -25,5 +25,23 @@ add_old_configure_assignment(
def rust_flags(compile_flags, warning_flags):
return compile_flags + warning_flags
set_config('MOZ_RUST_DEFAULT_FLAGS', rust_flags)
js_option('--disable-new-pass-manager',
help='Use the legacy LLVM pass manager in clang builds')
@depends('--enable-new-pass-manager', c_compiler, host, mozbuild_state_path)
def new_pass_manager_flags(enabled, compiler, host, mozbuild_state_path):
if host.os == 'OSX':
# If we're using Xcode's clang, we can't trust its version number
mozbuild_clang_dir = os.path.join(mozbuild_state_path, 'clang', 'bin')
if os.path.dirname(compiler.compiler) != mozbuild_clang_dir:
return None
if enabled and compiler.version >= '9.0.0':
if compiler.type == 'clang':
return ['-fexperimental-new-pass-manager']
elif compiler.type == 'clang-cl':
return ['-Xclang', '-fexperimental-new-pass-manager']
set_config('MOZ_NEW_PASS_MANAGER_FLAGS', new_pass_manager_flags)

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

@ -566,6 +566,8 @@ class CompileFlags(TargetCompileFlags):
('MOZBUILD_CFLAGS', None, ('CFLAGS',)),
('MOZBUILD_CXXFLAGS', None, ('CXXFLAGS',)),
('COVERAGE', context.config.substs.get('COVERAGE_CFLAGS'), ('CXXFLAGS', 'CFLAGS')),
('NEWPM', context.config.substs.get('MOZ_NEW_PASS_MANAGER_FLAGS'),
('CXXFLAGS', 'CFLAGS')),
)
TargetCompileFlags.__init__(self, context)