Commit 6ffd7924 authored by Hans Wennborg's avatar Hans Wennborg Committed by Commit Bot

Disable asserts in the Clang package

This allows the compiler to run a little faster. Clang will still
be running with assertions enabled on the Clang tip-of-tree waterfall
to catch regressions in Clang, or to catch existing asserts getting
triggered by code that's checked into Chromium.

Below are build times (each build was run twice to warm up the cache,
and the second build time was noted) of the 'chrome' target
configured with 'is_debug=false is_component_build=true'.

Linux
-----
asserts enabled:
real    43m51.506s
user    2304m36.334s
sys     93m34.650s

asserts disabled:
real    36m37.976s  (-16%)
user    1910m47.627s
sys     87m37.474s


Windows
-------
asserts enabled:
peak memory: 2341.99MB
real: 64m3.234s
qpc: 3843245179us

asserts disabled:
peak memory: 2343.40MB
real: 50m59.093s (-20%)
qpc: 3059111587us


Mac
---
asserts enabled:
real    175m19.768s
user    3960m35.641s
sys     168m42.376s

asserts disabled:
real    148m50.279s (-17%)
user    3336m16.310s
sys     171m51.878s


It also reduces the size of the Clang package:

59M        clang-356356-1-linux.tgz
33M        clang-356356-1-mac.tgz
57M        clang-356356-1-win.tgz
50M (-15%) clang-356356-2-linux.tgz
28M (-15%) clang-356356-2-mac.tgz
45M (-21%) clang-356356-2-win.tgz


Bug: 896306
Change-Id: I26068467119065a9d381f7f97f8dfac1defeb309
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1532107Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#645377}
parent 5abe053b
......@@ -217,7 +217,7 @@ def main():
if sys.platform.startswith('linux'):
opt_flags += ['--lto-lld']
build_cmd = [sys.executable, os.path.join(THIS_DIR, 'update.py'),
'--bootstrap', '--force-local-build',
'--bootstrap', '--disable-asserts', '--force-local-build',
'--run-tests'] + opt_flags
TeeCmd(build_cmd, log)
......
......@@ -43,7 +43,7 @@ if use_head_revision:
CLANG_REVISION = 'HEAD'
# This is incremented when pushing a new build of Clang at the same revision.
CLANG_SUB_REVISION=1
CLANG_SUB_REVISION=2
PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION)
......@@ -547,7 +547,8 @@ def UpdateClang(args):
targets = 'AArch64;ARM;Mips;PowerPC;SystemZ;WebAssembly;X86'
base_cmake_args = ['-GNinja',
'-DCMAKE_BUILD_TYPE=Release',
'-DLLVM_ENABLE_ASSERTIONS=ON',
'-DLLVM_ENABLE_ASSERTIONS=%s' %
('OFF' if args.disable_asserts else 'ON'),
'-DLLVM_ENABLE_PIC=OFF',
'-DLLVM_ENABLE_TERMINFO=OFF',
'-DLLVM_TARGETS_TO_BUILD=' + targets,
......@@ -573,6 +574,8 @@ def UpdateClang(args):
'-DCMAKE_INSTALL_PREFIX=' + LLVM_BOOTSTRAP_INSTALL_DIR,
'-DCMAKE_C_FLAGS=' + ' '.join(cflags),
'-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags),
# Ignore args.disable_asserts for the bootstrap compiler.
'-DLLVM_ENABLE_ASSERTIONS=ON',
]
if cc is not None: bootstrap_args.append('-DCMAKE_C_COMPILER=' + cc)
if cxx is not None: bootstrap_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
......@@ -951,6 +954,8 @@ def main():
parser = argparse.ArgumentParser(description='Build Clang.')
parser.add_argument('--bootstrap', action='store_true',
help='first build clang with CC, then with itself.')
parser.add_argument('--disable-asserts', action='store_true',
help='build with asserts disabled')
parser.add_argument('--force-local-build', action='store_true',
help="don't try to download prebuild binaries")
parser.add_argument('--gcc-toolchain', help='set the version for which gcc '
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment