summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt-viewer/opt-diff.py
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2017-07-17 18:00:41 +0000
committerAdam Nemet <anemet@apple.com>2017-07-17 18:00:41 +0000
commit659d7dbb0e82ab3f13f2e5eb0f6303f22bfd34e4 (patch)
treeab5444df6e6320808699c35cf5b1991864b7158d /llvm/tools/opt-viewer/opt-diff.py
parent6af25595622bb874060f62b0c4531a1f47a7eaf4 (diff)
downloadbcm5719-llvm-659d7dbb0e82ab3f13f2e5eb0f6303f22bfd34e4.tar.gz
bcm5719-llvm-659d7dbb0e82ab3f13f2e5eb0f6303f22bfd34e4.zip
[opt-viewer] Accept directories that are searched for opt.yaml files
This allows to pass the build directory where all the opt.yaml files are rather than find | xargs which may invoke opt-viewer multiple times producing incomplete html output. The patch generalizes the same functionality from opt-diff. Differential Revision: https://reviews.llvm.org/D35491 llvm-svn: 308200
Diffstat (limited to 'llvm/tools/opt-viewer/opt-diff.py')
-rwxr-xr-xllvm/tools/opt-viewer/opt-diff.py27
1 files changed, 10 insertions, 17 deletions
diff --git a/llvm/tools/opt-viewer/opt-diff.py b/llvm/tools/opt-viewer/opt-diff.py
index 9e921f8488d..f39432c8bc9 100755
--- a/llvm/tools/opt-viewer/opt-diff.py
+++ b/llvm/tools/opt-viewer/opt-diff.py
@@ -20,24 +20,17 @@ import optrecord
import argparse
from collections import defaultdict
from multiprocessing import cpu_count, Pool
-import os, os.path
-import fnmatch
-
-def find_files(dir_or_file):
- if os.path.isfile(dir_or_file):
- return [dir_or_file]
-
- all = []
- for dir, subdirs, files in os.walk(dir_or_file):
- for file in files:
- if fnmatch.fnmatch(file, "*.opt.yaml"):
- all.append( os.path.join(dir, file))
- return all
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=desc)
- parser.add_argument('yaml_dir_or_file_1')
- parser.add_argument('yaml_dir_or_file_2')
+ parser.add_argument(
+ 'yaml_dir_or_file_1',
+ help='An optimization record file or a directory searched for optimization '
+ 'record files that are used as the old version for the comparison')
+ parser.add_argument(
+ 'yaml_dir_or_file_2',
+ help='An optimization record file or a directory searched for optimization '
+ 'record files that are used as the new version for the comparison')
parser.add_argument(
'--jobs',
'-j',
@@ -53,8 +46,8 @@ if __name__ == '__main__':
parser.add_argument('--output', '-o', default='diff.opt.yaml')
args = parser.parse_args()
- files1 = find_files(args.yaml_dir_or_file_1)
- files2 = find_files(args.yaml_dir_or_file_2)
+ files1 = optrecord.find_opt_files([args.yaml_dir_or_file_1])
+ files2 = optrecord.find_opt_files([args.yaml_dir_or_file_2])
print_progress = not args.no_progress_indicator
all_remarks1, _, _ = optrecord.gather_results(files1, args.jobs, print_progress)
OpenPOWER on IntegriCloud