[llvm] r326126 - opt-diff: Support splitting to multiple output files
Adam Nemet via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 26 13:15:51 PST 2018
Author: anemet
Date: Mon Feb 26 13:15:51 2018
New Revision: 326126
URL: http://llvm.org/viewvc/llvm-project?rev=326126&view=rev
Log:
opt-diff: Support splitting to multiple output files
When reading the resulting files back with opt-viewer, they will be parsed in
parallel.
Modified:
llvm/trunk/tools/opt-viewer/opt-diff.py
Modified: llvm/trunk/tools/opt-viewer/opt-diff.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt-viewer/opt-diff.py?rev=326126&r1=326125&r2=326126&view=diff
==============================================================================
--- llvm/trunk/tools/opt-viewer/opt-diff.py (original)
+++ llvm/trunk/tools/opt-viewer/opt-diff.py Mon Feb 26 13:15:51 2018
@@ -37,12 +37,18 @@ if __name__ == '__main__':
type=int,
help='Max job count (defaults to %(default)s, the current CPU count)')
parser.add_argument(
+ '--max-size',
+ '-m',
+ default=100000,
+ type=int,
+ help='Maximum number of remarks stored in an output file')
+ parser.add_argument(
'--no-progress-indicator',
'-n',
action='store_true',
default=False,
help='Do not display any indicator of how many YAML files were read.')
- parser.add_argument('--output', '-o', default='diff.opt.yaml')
+ parser.add_argument('--output', '-o', default='diff{}.opt.yaml')
args = parser.parse_args()
files1 = optrecord.find_opt_files(args.yaml_dir_or_file_1)
@@ -60,9 +66,10 @@ if __name__ == '__main__':
for r in removed:
r.Added = False
- result = added | removed
+ result = list(added | removed)
for r in result:
r.recover_yaml_structure()
- with open(args.output, 'w') as stream:
- yaml.dump_all(result, stream)
+ for i in range(0, len(result), args.max_size):
+ with open(args.output.format(i / args.max_size), 'w') as stream:
+ yaml.dump_all(result[i:i + args.max_size], stream)
More information about the llvm-commits
mailing list