[PATCH] D63325: [Support][Time profiler] Make FE codegen blocks to be inside frontend blocks

Anton Afanasyev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 18 15:07:02 PDT 2019


anton-afanasyev marked 10 inline comments as done.
anton-afanasyev added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenAction.cpp:250-252
+      // Finish "Frontend" section starting inside clang::ParseAST()
+      if (llvm::timeTraceProfilerEnabled())
+        llvm::timeTraceProfilerEnd();
----------------
lebedev.ri wrote:
> I think i'm missing a point here.
> Why do we want to end `"Frontend"` section here,  exclude all this following diag/optremark/etc stuff?
The answer is below, we have `EmitBackendOutput()` there, calling Backend actions.


================
Comment at: clang/lib/CodeGen/CodeGenAction.cpp:256
       if (!getModule())
         return;
 
----------------
Also the function can return here, without finishing `Frontend` section, if it is below.


================
Comment at: clang/lib/CodeGen/CodeGenAction.cpp:306
 
       EmitBackendOutput(Diags, HeaderSearchOpts, CodeGenOpts, TargetOpts,
                         LangOpts, C.getTargetInfo().getDataLayout(),
----------------
@lebedev.ri We have `EmitBackendOutput()` here, calling Backend actions.


================
Comment at: clang/lib/Parse/ParseAST.cpp:154
   if (HaveLexer) {
-    llvm::TimeTraceScope TimeScope("Frontend", StringRef(""));
     P.Initialize();
----------------
lebedev.ri wrote:
> Why not keep this as `"Lexing"`?
Hmm... Thanks, I'm to keep it with this name.


================
Comment at: clang/lib/Parse/ParseAST.cpp:182
   finalize(S.TemplateInstCallbacks, S);
 
   std::swap(OldCollectStats, S.CollectStats);
----------------
lebedev.ri wrote:
> I.e. why do we not want to end it here, where the other stats are printed?
Cause `HandleTranslationUnit()` contains Backend calling.


================
Comment at: clang/test/Driver/check-time-trace-sections.py:1
+#!/usr/bin/env python
+
----------------
lebedev.ri wrote:
> Does some other test already require python?
Sorry, what do you mean? I see many tests inside `clang/test/` and `llvm/test/` using python when Filecheck is not enough. Mostly they are using `python -c ...` as part of the pipe, but there are py-files as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63325/new/

https://reviews.llvm.org/D63325





More information about the cfe-commits mailing list