llvm.org GIT mirror llvm / bd8ae82
opt-diff: Support splitting to multiple output files When reading the resulting files back with opt-viewer, they will be parsed in parallel. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326126 91177308-0d34-0410-b5e6-96231b3b80d8 Adam Nemet 1 year, 5 months ago
1 changed file(s) with 11 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
3636 type=int,
3737 help='Max job count (defaults to %(default)s, the current CPU count)')
3838 parser.add_argument(
39 '--max-size',
40 '-m',
41 default=100000,
42 type=int,
43 help='Maximum number of remarks stored in an output file')
44 parser.add_argument(
3945 '--no-progress-indicator',
4046 '-n',
4147 action='store_true',
4248 default=False,
4349 help='Do not display any indicator of how many YAML files were read.')
44 parser.add_argument('--output', '-o', default='diff.opt.yaml')
50 parser.add_argument('--output', '-o', default='diff{}.opt.yaml')
4551 args = parser.parse_args()
4652
4753 files1 = optrecord.find_opt_files(args.yaml_dir_or_file_1)
5965 for r in removed:
6066 r.Added = False
6167
62 result = added | removed
68 result = list(added | removed)
6369 for r in result:
6470 r.recover_yaml_structure()
6571
66 with open(args.output, 'w') as stream:
67 yaml.dump_all(result, stream)
72 for i in range(0, len(result), args.max_size):
73 with open(args.output.format(i / args.max_size), 'w') as stream:
74 yaml.dump_all(result[i:i + args.max_size], stream)