2018-11-01 12:25:03 +00:00
|
|
|
# opt
|
|
|
|
|
2022-06-27 11:23:12 +01:00
|
|
|
> A tool that takes LLVM source files and runs specified optimizations and/or analysis on them.
|
2019-06-04 10:00:16 +01:00
|
|
|
> More information: <https://llvm.org/docs/CommandGuide/opt.html>.
|
2018-11-01 12:25:03 +00:00
|
|
|
|
|
|
|
- Run an optimization or analysis on a bitcode file:
|
|
|
|
|
|
|
|
`opt -{{passname}} {{path/to/file.bc}} -S -o {{file_opt.bc}}`
|
|
|
|
|
2021-01-31 17:05:18 +00:00
|
|
|
- Output the Control Flow Graph of a function to a `.dot` file:
|
2018-11-01 12:25:03 +00:00
|
|
|
|
|
|
|
`opt {{-dot-cfg}} -S {{path/to/file.bc}} -disable-output`
|
|
|
|
|
|
|
|
- Optimize the program at level 2 and output the result to another file:
|
|
|
|
|
|
|
|
`opt -O2 {{path/to/file.bc}} -S -o {{path/to/output_file.bc}}`
|