Add time tracing of backend passes invoked by new PassManager.
I know this is in line with what is done in old-pm, but i find the middle-end names to be very useless.
In particular, why is the actual optimization pass name is always in the description, and the actual timeslice name is always the same generic "Opt???"?
IMHO the actual optimization pass name should be the Name, not Detail.
Same name "Opt???" makes the same color in a flamechart.
I *believe* it also makes double-clicking on one select *all* the slices with that "Opt???" name.
In other words, how do i group by the pass name?
It can be argued either way which is more important, sure.
Btw, have you tried Speedscope (https://www.speedscope.app) for visualization? It works better than chrome://tracing, trying to show details in chart boxes.
No, i know it exists, but i didn't try it..
I might have fallen a bit out of the loop, but can you tell me a bit more details about the use case here? There is no in-tree support for new-PM backend passes currently, is this for an out-of-tree user?
What about all the other IRUnit nestings beyond function passes in module pipelines?
Those questions aside, I'm not happy with the implementation. It uses global state, which is bad on its own, but in a way that isn't remotely threadsafe. It also cannot be easily made threadsafe without bigger redesign. Therefore, this isn't going to work in the new PM.
In the new PassManager we have a quite nice instrumentation infrastructure, which is perfectly suited to hook tracers such as this one into the pipeline execution. I suggest implementing -ftime-trace on top of that infrastructure. That being said, it appears as if there's quite some overlap between this tracer and the pass timing things. Why is the existing mechanism insufficient? Is the difference really just the output format? In which case, why not make that customizable instead of rolling out a second timing instrumentation?