LoopPass Question

Are LoopPasses allowed to maintain state between runOnLoop invocations?
The documentation is not clear on this point.

                                                  -Dave

Are LoopPasses allowed to maintain state between runOnLoop invocations?

What kind of information are you looking to maintain between runOnLoop invocations ?

The documentation is not clear on this point.

doInitialization() and doFinalization() will be run for each pass before and after runOnLoop().

For each pass
   doInitialization()
For each pass
   runOnLoop()
For each pass
   doFinalization()

So each pass can collect information during initialization pass to use during runOnLoop().

> Are LoopPasses allowed to maintain state between runOnLoop
> invocations?

What kind of information are you looking to maintain between runOnLoop
invocations ?

Cached analysis answers.

> The documentation is not clear on this point.

doInitialization() and doFinalization() will be run for each pass
before and after runOnLoop().

For each pass
   doInitialization()
For each pass
   runOnLoop()
For each pass
   doFinalization()

So each pass can collect information during initialization pass to use
during runOnLoop().

runOnLoop computes some information about basic blocks. I would like
to reuse that information in later runOnLoop invocations. Is the loop pass
created and destroyed for each invocation?

                                                   -Dave

runOnLoop computes some information about basic blocks. I would like
to reuse that information in later runOnLoop invocations.

PassA::runOnLoop() is executed only once for each loop.

Is the loop pass
created and destroyed for each invocation?

Nope.