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

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 09:48:48 PDT 2019


thakis created this revision.
thakis added a reviewer: anton-afanasyev.
Herald added subscribers: hiraditya, mehdi_amini.
Herald added a project: LLVM.

https://reviews.llvm.org/D60782

Files:
  llvm/lib/IR/LegacyPassManager.cpp


Index: llvm/lib/IR/LegacyPassManager.cpp
===================================================================
--- llvm/lib/IR/LegacyPassManager.cpp
+++ llvm/lib/IR/LegacyPassManager.cpp
@@ -1629,14 +1629,14 @@
     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 @@
     removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
   }
 
-  if (ProfileTime)
-    llvm::timeTraceProfilerEnd();
-
   return Changed;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60782.195405.patch
Type: text/x-patch
Size: 956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190416/40fd17f2/attachment.bin>


More information about the llvm-commits mailing list