[PATCH] D47196: [Time-report ](2): Recursive timers in Clang

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 31 12:19:16 PDT 2018


efriedma added a comment.

I think there's something weird happening with your timers if they're showing half a second spent parsing or instantiating std::declval: it doesn't have a definition, anywhere (it's just a placeholder for template metaprogramming tricks).



================
Comment at: lib/AST/Expr.cpp:544
+        FrontendTimesIsEnabled,
+        getFrontendFunctionTimeCtx<const FunctionDecl *>(), {FD, 0});
     if (IT != PrettyFunction && IT != PrettyFunctionNoVirtual &&
----------------
You shouldn't need a separate timer here; `__func__` should only show up inside a function definition anyway.


================
Comment at: lib/Analysis/AnalysisDeclContext.cpp:99
+        FrontendTimesIsEnabled,
+        getFrontendFunctionTimeCtx<const FunctionDecl *>(), {FD, 0});
     Stmt *Body = FD->getBody();
----------------
Not sure what you're trying to time here.


================
Comment at: lib/Parse/Parser.cpp:1131
       Actions.CheckForFunctionRedefinition(FnD);
       Actions.MarkAsLateParsedTemplate(FnD, DP, Toks);
     }
----------------
CheckForFunctionRedefinition and MarkAsLateParsedTemplate are both pretty cheap; not sure it's worth separately timing them.


================
Comment at: lib/Sema/SemaDecl.cpp:2996
 /// Returns true if there was an error, false otherwise.
 bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD,
                              Scope *S, bool MergeTypeWithOld) {
----------------
MergeFunctionDecl only has one caller: CheckFunctionDeclaration.  Probably makes more sense to time that, instead?


================
Comment at: lib/Sema/SemaDecl.cpp:3595
 bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old,
                                         Scope *S, bool MergeTypeWithOld) {
+  FrontendTimeRAII<const FunctionDecl *> FTRAII(
----------------
MergeCompatibleFunctionDecls is only called by MergeFunctionDecl.


https://reviews.llvm.org/D47196





More information about the cfe-commits mailing list