diff options
author | Andrew Kaylor <andrew.kaylor@intel.com> | 2016-04-22 22:06:11 +0000 |
---|---|---|
committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2016-04-22 22:06:11 +0000 |
commit | aa641a51719eed9509566e8352bf59e75e2c81b4 (patch) | |
tree | 60a4f5098d6d5c714248a27665004e1b029f1f73 /llvm/test/Other/opt-bisect-helper.py | |
parent | 1e9e615f92179a4be8e1df70acf6329b0bb198a7 (diff) | |
download | bcm5719-llvm-aa641a51719eed9509566e8352bf59e75e2c81b4.tar.gz bcm5719-llvm-aa641a51719eed9509566e8352bf59e75e2c81b4.zip |
Re-commit optimization bisect support (r267022) without new pass manager support.
The original commit was reverted because of a buildbot problem with LazyCallGraph::SCC handling (not related to the OptBisect handling).
Differential Revision: http://reviews.llvm.org/D19172
llvm-svn: 267231
Diffstat (limited to 'llvm/test/Other/opt-bisect-helper.py')
-rwxr-xr-x | llvm/test/Other/opt-bisect-helper.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/test/Other/opt-bisect-helper.py b/llvm/test/Other/opt-bisect-helper.py new file mode 100755 index 00000000000..d75950f11d8 --- /dev/null +++ b/llvm/test/Other/opt-bisect-helper.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +import os +import sys +import argparse +import subprocess + +parser = argparse.ArgumentParser() + +parser.add_argument('--start', type=int, default=0) +parser.add_argument('--end', type=int, default=(1 << 32)) +parser.add_argument('--optcmd', default=("opt")) +parser.add_argument('--filecheckcmd', default=("FileCheck")) +parser.add_argument('--prefix', default=("CHECK-BISECT")) +parser.add_argument('--test', default=("")) + +args = parser.parse_args() + +start = args.start +end = args.end + +opt_command = [args.optcmd, "-O2", "-opt-bisect-limit=%(count)s", "-S", args.test] +check_command = [args.filecheckcmd, args.test, "--check-prefix=%s" % args.prefix] +last = None +while start != end and start != end-1: + count = int(round(start + (end - start)/2)) + cmd = [x % {'count':count} for x in opt_command] + print("opt: " + str(cmd)) + opt_result = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + filecheck_result = subprocess.Popen(check_command, stdin=opt_result.stdout) + opt_result.stdout.close() + opt_result.stderr.close() + filecheck_result.wait() + if filecheck_result.returncode == 0: + start = count + else: + end = count + +print("Last good count: %d" % start) |