Author: vsapsai Date: Tue Sep 17 17:05:45 2019 New Revision: 372191 URL: http://llvm.org/viewvc/llvm-project?rev=372191&view=rev Log: [Timers] Fix printing some `-ftime-report` sections twice. Fixes PR40328.
Starting from r324788 timer groups aren't cleared automatically when printed out. As a result some timer groups were printed one more time. For example, "Pass execution timing report" was printed again in `ManagedStatic<PassTimingInfo>` destructor, "DWARF Emission" in `ManagedStatic<Name2PairMap> NamedGroupedTimers` destructor. Fix by clearing timer groups manually. Reviewers: thegameg, george.karpenkov Reviewed By: thegameg Subscribers: aprantl, jkorous, dexonsmith, ributzka, aras-p, cfe-commits Differential Revision: https://reviews.llvm.org/D67683 Modified: cfe/trunk/tools/driver/cc1_main.cpp cfe/trunk/tools/driver/cc1as_main.cpp cfe/trunk/tools/driver/driver.cpp Modified: cfe/trunk/tools/driver/cc1_main.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=372191&r1=372190&r2=372191&view=diff ============================================================================== --- cfe/trunk/tools/driver/cc1_main.cpp (original) +++ cfe/trunk/tools/driver/cc1_main.cpp Tue Sep 17 17:05:45 2019 @@ -253,6 +253,7 @@ int cc1_main(ArrayRef<const char *> Argv // If any timers were active but haven't been destroyed yet, print their // results now. This happens in -disable-free mode. llvm::TimerGroup::printAll(llvm::errs()); + llvm::TimerGroup::clearAll(); if (llvm::timeTraceProfilerEnabled()) { SmallString<128> Path(Clang->getFrontendOpts().OutputFile); Modified: cfe/trunk/tools/driver/cc1as_main.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=372191&r1=372190&r2=372191&view=diff ============================================================================== --- cfe/trunk/tools/driver/cc1as_main.cpp (original) +++ cfe/trunk/tools/driver/cc1as_main.cpp Tue Sep 17 17:05:45 2019 @@ -609,6 +609,7 @@ int cc1as_main(ArrayRef<const char *> Ar // If any timers were active but haven't been destroyed yet, print their // results now. TimerGroup::printAll(errs()); + TimerGroup::clearAll(); return !!Failed; } Modified: cfe/trunk/tools/driver/driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=372191&r1=372190&r2=372191&view=diff ============================================================================== --- cfe/trunk/tools/driver/driver.cpp (original) +++ cfe/trunk/tools/driver/driver.cpp Tue Sep 17 17:05:45 2019 @@ -499,6 +499,7 @@ int main(int argc_, const char **argv_) // If any timers were active but haven't been destroyed yet, print their // results now. This happens in -disable-free mode. llvm::TimerGroup::printAll(llvm::errs()); + llvm::TimerGroup::clearAll(); #ifdef _WIN32 // Exit status should not be negative on Win32, unless abnormal termination. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits