[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / llvm / tools / opt-viewer / extract-reproducers.py
blob610439d6f4c94751daa69a51e3122e781657fef4
1 #!/usr/bin/env python
3 desc = """
4 A script to extract ConstraintElimination's reproducer remarks. The extracted
5 modules are written as textual LLVM IR to files named reproducerXXXX.ll in the
6 current directory.
7 """
9 import optrecord
10 import argparse
12 if __name__ == "__main__":
13 parser = argparse.ArgumentParser(description=desc)
14 parser.add_argument(
15 "yaml_dirs_or_files",
16 nargs="+",
17 help="List of optimization record files or directories searched "
18 "for optimization record files.",
21 args = parser.parse_args()
23 print_progress = False
24 jobs = 1
26 files = optrecord.find_opt_files(*args.yaml_dirs_or_files)
27 if not files:
28 parser.error("No *.opt.yaml files found")
29 sys.exit(1)
31 all_remarks, file_remarks, _ = optrecord.gather_results(files, jobs, True)
33 i = 0
34 for r in all_remarks:
35 if r[1] != "constraint-elimination" or r[2] != "Reproducer":
36 continue
37 with open("reproducer{}.ll".format(i), "wt") as f:
38 f.write(r[7][1][0][1])
39 i += 1