# HG changeset patch # User David Major # Date 1531778389 14400 # Node ID e09ba0bb848afe8b66c4cdd56794301b790c6c34 # Parent cf51b2ad1549fd0a5f858bc6a9041a37e7e63f41 Bug 1475660: Make clang-cl PGO enable LTO (enables ThinLTO in official builds) r=froydnj,glandium diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -1572,23 +1572,27 @@ include('windows.configure', when=is_win # ============================================================== js_option('--enable-lto', nargs='?', choices=('full', 'thin'), help='Enable LTO') -@depends('--enable-lto', c_compiler) +@depends('--enable-lto', 'MOZ_PGO', c_compiler) @imports('multiprocessing') -def lto(value, c_compiler): +def lto(value, pgo, c_compiler): cflags = [] ldflags = [] enabled = None + # MSVC's implementation of PGO implies LTO. Make clang-cl match this. + if c_compiler.type == 'clang-cl' and pgo and value.origin == 'default': + value = ['thin'] + if value: enabled = True if c_compiler.type == 'clang': if len(value) and value[0].lower() == 'full': cflags.append("-flto") ldflags.append("-flto") else: cflags.append("-flto=thin")