[LLVMdev] LoopPass doFinalization() called multiple times per program?
stephen.mcgruer at gmail.com
Thu Dec 13 09:58:12 PST 2012
I'm wondering if the documentation for LoopPass (
http://llvm.org/docs/WritingAnLLVMPass.html#LoopPass) is misleading or
incorrect (or if I'm just missing something.) The documentation states:
"The doFinalization method ... is called when the pass framework has
every loop in the program being compiled."
>From this, I understood that for a single instance of a LoopPass sub-class,
the doFinalization method would be called exactly once, after all loops had
been seen. However in practice I am seeing doFinalization() being called
multiple times per program. Digging into the code, it appears that
LPPassManager actually makes the calls to doFinalization() at the end of
it's runOnFunction() method (
http://llvm.org/docs/doxygen/html/LoopPass_8cpp_source.html#l00281, at time
of writing). This therefore means that doFinalization() can be called
multiple times per LoopPass; as many as there are functions defined in the
Assuming I have made no mistakes here, is this a case of poorly written
documentation, or an error in the implementation? I note that FPPassManager
does it calls to FunctionPass' doFinalization() in it's own
doFinalization() method, which seems the correct behaviour to me.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev