[clang] 55d887b - [time-trace] Add optimizer and codegen regions to NPM

Wei Wang via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 21 20:20:50 PST 2022


Author: Wei Wang
Date: 2022-01-21T19:17:57-08:00
New Revision: 55d887b833646baeea0e3371fd2cbbd7550a8d4d

URL: https://github.com/llvm/llvm-project/commit/55d887b833646baeea0e3371fd2cbbd7550a8d4d
DIFF: https://github.com/llvm/llvm-project/commit/55d887b833646baeea0e3371fd2cbbd7550a8d4d.diff

LOG: [time-trace] Add optimizer and codegen regions to NPM

Optimizer and codegen regions were only added to legacy PM. Add
them to NPM as well.

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

Added: 
    

Modified: 
    clang/lib/CodeGen/BackendUtil.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 6b8e052305b49..9ae5c870afc81 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1492,8 +1492,11 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
   }
 
   // Now that we have all of the passes ready, run them.
-  PrettyStackTraceString CrashInfo("Optimizer");
-  MPM.run(*TheModule, MAM);
+  {
+    PrettyStackTraceString CrashInfo("Optimizer");
+    llvm::TimeTraceScope TimeScope("Optimizer");
+    MPM.run(*TheModule, MAM);
+  }
 }
 
 void EmitAssemblyHelper::RunCodegenPipeline(
@@ -1525,8 +1528,11 @@ void EmitAssemblyHelper::RunCodegenPipeline(
     return;
   }
 
-  PrettyStackTraceString CrashInfo("Code generation");
-  CodeGenPasses.run(*TheModule);
+  {
+    PrettyStackTraceString CrashInfo("Code generation");
+    llvm::TimeTraceScope TimeScope("CodeGenPasses");
+    CodeGenPasses.run(*TheModule);
+  }
 }
 
 /// A clean version of `EmitAssembly` that uses the new pass manager.


        


More information about the cfe-commits mailing list