[llvm] r358834 - ftime-trace: Trace the name of the currently active pass as well.

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 20 16:22:46 PDT 2019


Author: nico
Date: Sat Apr 20 16:22:45 2019
New Revision: 358834

URL: http://llvm.org/viewvc/llvm-project?rev=358834&view=rev
Log:
ftime-trace: Trace the name of the currently active pass as well.

Differential Revision: https://reviews.llvm.org/D60782

Modified:
    llvm/trunk/lib/IR/LegacyPassManager.cpp

Modified: llvm/trunk/lib/IR/LegacyPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LegacyPassManager.cpp?rev=358834&r1=358833&r2=358834&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LegacyPassManager.cpp (original)
+++ llvm/trunk/lib/IR/LegacyPassManager.cpp Sat Apr 20 16:22:45 2019
@@ -1629,14 +1629,14 @@ bool FPPassManager::runOnFunction(Functi
     FunctionSize = F.getInstructionCount();
   }
 
-  bool ProfileTime = llvm::timeTraceProfilerEnabled();
-  if (ProfileTime)
-    llvm::timeTraceProfilerBegin("OptFunction", F.getName());
+  llvm::TimeTraceScope FunctionScope("OptFunction", F.getName());
 
   for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
     FunctionPass *FP = getContainedPass(Index);
     bool LocalChanged = false;
 
+    llvm::TimeTraceScope PassScope("RunPass", FP->getPassName());
+
     dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, F.getName());
     dumpRequiredSet(FP);
 
@@ -1674,9 +1674,6 @@ bool FPPassManager::runOnFunction(Functi
     removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
   }
 
-  if (ProfileTime)
-    llvm::timeTraceProfilerEnd();
-
   return Changed;
 }
 




More information about the llvm-commits mailing list