[LLVMdev] Passes ordering

Jianzhou Zhao jianzhou at seas.upenn.edu
Mon May 17 11:54:58 PDT 2010


Hi LLVM,

I have a question about how to ensure one pass runs exactly after another
pass. In the implementation of opt.cpp, if the VerifyEach is set, a Verifier
from llvm::createVerifierPass() is added after each pass. Is this
verifier called
after the verified pass immediately?

The interfaces of PassManager only allows us to specify which passes the
current pass replies on, and if the the current pass breaks any
existing passes.
PassManager will schedule the pass at the right time w.r.t these constraints.
But it doesn't say that a pass added exactly after an old pass will
follow this old
pass at the compilation time. I looked into the code of PassManager.
It seems that
PassManager doesn't change the order of passes arbitrarily, but will
rerun dependent
passes before a pass that requires them. For me, this may affect the
following verifier.
For example, suppose I have a pass and its verifier, and the verifier
checks the
correctness of the pass with some information from this pass, if any
other passes
run between them, the verifier may not check this precisely.

As an efficient compilation, PassManager also batches passes for a function or
block to run together, without passes the source file once again. Will
this ensure not
to reorder passes?

Thanks a lot.
-- 
Jianzhou



More information about the llvm-dev mailing list