HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

opt — Run optimizations and analyze LLVM source files. More information: <https://llvm.org/docs/CommandGui

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandrunllvmandoptimizationsclianalyzeopt

Problem

How to use the opt command: Run optimizations and analyze LLVM source files. More information: <https://llvm.org/docs/CommandGuide/opt.html>.

Solution

opt — Run optimizations and analyze LLVM source files. More information: <https://llvm.org/docs/CommandGuide/opt.html>.

Run an optimization or analysis on a bitcode file:
opt -{{passname}} {{path/to/file.bc}} -S -o {{file_opt.bc}}


Output the Control Flow Graph of a function to a .dot file:
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}}

Code Snippets

Run an optimization or analysis on a bitcode file

opt -{{passname}} {{path/to/file.bc}} -S -o {{file_opt.bc}}

Output the Control Flow Graph of a function to a `.dot` file

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}}

Context

tldr-pages: common/opt

Revisions (0)

No revisions yet.