Shuzheng
Shuzheng

Reputation: 13840

How do I make LLVM opt output an IR file when given an IR file?

I use LLVM opt to run a pass using, e.g, opt -load libMyPass.so my-pass foo.ll > foo1.ll.

foo.ll is an IR file, and I want foo1.ll to contain the result, of running the pass, in IR format. But foo1.ll becomes a bitcode file, so I need to issue llvm-dis foo1.ll to transform it into IR format.

How do I avoid having to run llvm-dis, and make opt transform from IR format to IR format?

Upvotes: 3

Views: 1927

Answers (1)

Nicolas Lykke Iversen
Nicolas Lykke Iversen

Reputation: 4205

opt has a nice option for doing that:

-S           - Write output as LLVM assembly

I guess what confuses you is that LLVM assembly is a synonym for LLVM IR.

Upvotes: 9

Related Questions