John Wickerson
John Wickerson

Reputation: 1232

Multiple LLVM passes with single call

In general, if I put two LLVM passes into a single command-line call, like this...

$(LLVM_HOME)opt -my-pass -another-pass < foo1.bc > foo2.bc

...is this defined to be exactly the same as running the two passes consecutively, with an additional intermediate file, like this...

$(LLVM_HOME)opt -my-pass < foo1.bc > foo11.bc
$(LLVM_HOME)opt -another-pass < foo11.bc > foo2.bc

...or are those two passes performed simultaneously in some way?

Upvotes: 3

Views: 1149

Answers (1)

dune.rocks
dune.rocks

Reputation: 517

If the two passes are transformation passes, like -simplifycfg and -licm, then yes, you can think of there being an intermediary file between the two and run the commands as you suggest.

However, there also exist analysis passes, like -aa for alias analysis. These ones will not work as you describe, because they don't massage the IR, they just provide information to passes that do (like -licm for example).

So, opt -aa -licm is not equivalent to opt -aa followed by opt -licm.

Upvotes: 2

Related Questions