]> granicus.if.org Git - clang/commitdiff
[Timers] Fix printing some `-ftime-report` sections twice. Fixes PR40328.
authorVolodymyr Sapsai <vsapsai@apple.com>
Wed, 18 Sep 2019 00:05:45 +0000 (00:05 +0000)
committerVolodymyr Sapsai <vsapsai@apple.com>
Wed, 18 Sep 2019 00:05:45 +0000 (00:05 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372191 91177308-0d34-0410-b5e6-96231b3b80d8

tools/driver/cc1_main.cpp
tools/driver/cc1as_main.cpp
tools/driver/driver.cpp

index 29767b880b62d26b6952625c7590121194522342..9ed15f51b11466323b34ff7d09fb4a263a91b17c 100644 (file)
@@ -253,6 +253,7 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
   // 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);
index fbeea0dd3b02a5afe5153d7105ef0068ddfbed5b..ae58a95f36f5b0e8bb33624eb058707b79fbd8f4 100644 (file)
@@ -609,6 +609,7 @@ int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
   // If any timers were active but haven't been destroyed yet, print their
   // results now.
   TimerGroup::printAll(errs());
+  TimerGroup::clearAll();
 
   return !!Failed;
 }
index eebc8920fe0ab866107a8d8f40ac0713b754389d..f1600490017d74210d7837831bddd1efffdda1e8 100644 (file)
@@ -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.