Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: tools/clang/scripts/package.py

Issue 2793343002: Add --enable-pgo option to build clang with PGO
Patch Set: Add --enable-pgo option to build clang with PGO Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/clang/scripts/package.py
diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py
index 85840cdf008db46eb8ee47b2e25a5bb12ad1bfe3..1f2deb4925311cd59b4025078fa1e5310db77413 100755
--- a/tools/clang/scripts/package.py
+++ b/tools/clang/scripts/package.py
@@ -163,6 +163,8 @@ def main():
parser = argparse.ArgumentParser(description='build and package clang')
parser.add_argument('--upload', action='store_true',
help='Upload the target archive to Google Cloud Storage.')
+ parser.add_argument('--enable-pgo', action='store_true',
+ help='Build clang with GO enabled.')
Nico 2017/04/07 15:58:53 Typo GO. Also, why have a flag for this? Shouldn'
matthewtff.asm 2017/04/11 12:14:43 I believe it should be default. Made a flag just i
args = parser.parse_args()
# Check that the script is not going to upload a toolchain built from HEAD.
@@ -186,8 +188,8 @@ def main():
# Check if Google Cloud Storage already has the artifacts we want to build.
if (args.upload and GsutilArchiveExists(pdir, platform) and
- not sys.platform.startswith('linux') or
- GsutilArchiveExists(golddir, platform)):
+ (not sys.platform.startswith('linux') or
+ GsutilArchiveExists(golddir, platform))):
Nico 2017/04/07 15:58:53 This looks like a good change, but also unrelated.
print ('Desired toolchain revision %s is already available '
'in Google Cloud Storage:') % expected_stamp
print 'gs://chromium-browser-clang-staging/%s/%s.tgz' % (platform, pdir)
@@ -229,11 +231,21 @@ def main():
opt_flags = []
if sys.platform.startswith('linux'):
opt_flags += ['--lto-gold-plugin']
+
+ if sys.platform != 'win32' and args.enable_pgo:
+ opt_flags += ['--enable-pgo']
+ else:
+ opt_flags += ['--bootstrap']
+
build_cmd = [sys.executable, os.path.join(THIS_DIR, 'update.py'),
- '--bootstrap', '--force-local-build',
- '--run-tests'] + opt_flags
+ '--force-local-build', '--run-tests'] + opt_flags
TeeCmd(build_cmd, log)
+ if args.enable_pgo:
+ global LLVM_RELEASE_DIR
+ LLVM_RELEASE_DIR = os.path.join(LLVM_RELEASE_DIR, 'tools', 'clang',
+ 'stage2-instrumented-bins', 'tools', 'clang', 'stage2-bins')
+
stamp = open(STAMP_FILE).read().rstrip()
if stamp != expected_stamp:
print 'Actual stamp (%s) != expected stamp (%s).' % (stamp, expected_stamp)
@@ -319,7 +331,9 @@ def main():
# Copy libc++ headers.
if sys.platform == 'darwin':
- shutil.copytree(os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'include', 'c++'),
+ install_dir = LLVM_RELEASE_DIR if args.enable_pgo else \
+ LLVM_BOOTSTRAP_INSTALL_DIR
+ shutil.copytree(os.path.join(install_dir, 'include', 'c++'),
os.path.join(pdir, 'include', 'c++'))
# Copy buildlog over.

Powered by Google App Engine
This is Rietveld 408576698