================ @@ -39,19 +39,20 @@ Timer *getPassTimer(Pass *); /// This class implements -time-passes functionality for new pass manager. /// It provides the pass-instrumentation callbacks that measure the pass /// execution time. They collect timing info into individual timers as -/// passes are being run. At the end of its life-time it prints the resulting -/// timing report. +/// passes are being run. class TimePassesHandler { /// Value of this type is capable of uniquely identifying pass invocations. /// It is a pair of string Pass-Identifier (which for now is common /// to all the instance of a given pass) + sequential invocation counter. using PassInvocationID = std::pair<StringRef, unsigned>; /// Groups of timers for passes and analyses. - TimerGroup PassTG; - TimerGroup AnalysisTG; + TimerGroup &PassTG = + NamedRegionTimer::getNamedTimerGroup(PassGroupName, PassGroupDesc); + TimerGroup &AnalysisTG = NamedRegionTimer::getNamedTimerGroup( + AnalysisGroupName, AnalysisGroupDesc); - using TimerVector = llvm::SmallVector<std::unique_ptr<Timer>, 4>; + using TimerVector = llvm::SmallVector<Timer *, 4>; ---------------- alanzhao1 wrote:
I mean this is sort of the end result we want - we need the timers to be accessible outside of the pass manager's lifetime. It's also somewhat debatable whether or not the there is a memory leak since the TimerGroups store pointers to their timers anyways. https://github.com/llvm/llvm-project/pull/130375 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits