ftime-trace: Trace the name of the currently active pass as well.
authorNico Weber <nicolasweber@gmx.de>
Sat, 20 Apr 2019 23:22:45 +0000 (23:22 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sat, 20 Apr 2019 23:22:45 +0000 (23:22 +0000)
Differential Revision: https://reviews.llvm.org/D60782

llvm-svn: 358834

llvm/lib/IR/LegacyPassManager.cpp

index e2717f7..3e8ec1a 100644 (file)
@@ -1629,14 +1629,14 @@ bool FPPassManager::runOnFunction(Function &F) {
     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(Function &F) {
     removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
   }
 
-  if (ProfileTime)
-    llvm::timeTraceProfilerEnd();
-
   return Changed;
 }