This is an archive of the discontinued LLVM Phabricator instance.

[New PM][PassInstrumentation] enhancing PassInstrumentation with PassManager tracking
Changes PlannedPublic

Authored by fedor.sergeev on Sep 4 2018, 7:43 AM.

Details

Summary

In order to implement -time-passes functionality we need to be able to pause
PassManager's own timer when starting execution (and timer) for nested passes.

For that we need to be able to track which PassManager is currently being executed.

Adding startPassManager/endPassManager points to PassInstrumentation and call them
in all the pass managers/pass adaptors. Also adding startIteration point for
repeating adaptors (e.g RepeatPass) since that was pretty much the only
remaining piece of nontrivial pass execution tracking we were lacking
(albeit not needed for -time-passes).

Introducing PassExecutionLocation which is a wrapper for PassExecutionCounter
to provide a stable interface to be able to extend it later with extra information
(e.g. pass execution stack) if needed.
All the callbacks now take PassExecutionLocation.

Majority of the changes are rather mechanical ones.

Diff Detail

Event Timeline

fedor.sergeev created this revision.Sep 4 2018, 7:43 AM

rebased and somewhat simplified by removing PassManager tracking inside the PassInstrumentation object
itself. It is left for discretion of the callbacks implementing particular instrumentations.
Subsequent -time-passes implementation will use it this way.

fedor.sergeev edited the summary of this revision. (Show Details)Sep 6 2018, 9:04 AM

adding unittest changes, making unittest essentially the same as shown in D51973

adding const to PassManager parameter of callbacks.

I don't fully understand the rationale behind this. How is this different compared to a before/after instrumentation matching the PassManagers?

I don't fully understand the rationale behind this. How is this different compared to a before/after instrumentation matching the PassManagers?

To be honest, the rationale is nearly dead.
It was useful for -time-passes when we were passing instance pointers and were doing nontrivial things with PM timers.
Right now we just ignore pass managers there.
So the only reason for these interface existence is that I would like to be able to move DebugLogging functionality to PassInstrumentation
and start/finish points are the only places in code where we have DebugLogging that is not yet covered by PassInstrumentation.

That hints these points might be useful for nontrivial instrumentations in future.
I can defer this patch until I prepare DebugLogging replacement patch.

fedor.sergeev planned changes to this revision.Mar 17 2019, 11:16 PM

changing status to reflect that there is no active work on this patch atm.

Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2019, 11:16 PM