[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-08-09 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

Somewhere around CompilerInvocation::CreateFromArgs is probably appropriate.


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-08-09 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 added a comment.

In https://reviews.llvm.org/D45619#1192803, @craig.topper wrote:

> I'm unclear why the we would want to assign clang's FrontendTimesIsEnabled 
> from inside CodeGenAction. If I'm understanding the intentions here, the goal 
> was to add more timing infrastructure to clang. But if the enabling is tied 
> to CodeGenAction, then doesn't that mean any new clang timers wouldn't work 
> under -fsyntax-only?


Historically, it was done to get compilation times for separate files (to find 
the longest times). Because of that I did not assume usage of -fsyntax-only. Is 
it important? Should I move this activity into another place? If YES could you 
give me a hint where it should be done?


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-08-08 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

Assignment restored in r339281. I'll file a bug to merge to 7.0


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-08-08 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

Ok I'll add that back.

I'm unclear why the we would want to assign clang's FrontendTimesIsEnabled from 
inside CodeGenAction. If I'm understanding the intentions here, the goal was to 
add more timing infrastructure to clang. But if the enabling is tied to 
CodeGenAction, then doesn't that mean any new clang timers wouldn't work under 
-fsyntax-only?


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-08-08 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

Oh, oops, I should have spotted that.  No, the point of this was to separate 
the timing infrastructure, not to change the behavior of -ftime-report.

Should be a one-line change to add "llvm::TimePassesIsEnabled = TimePasses" 
back to BackendConsumer::BackendConsumer.  (Maybe we can add flags to control 
them separately as a followup.)


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-08-08 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

Correct me if I'm wrong, but after this change llvm no longer enables the 
timing of individual passes when -ftime-report is passed? Was that intentional?


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-06-27 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon closed this revision.
RKSimon added a comment.

This was committed at https://reviews.llvm.org/rL330571


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-24 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 added a comment.

In https://reviews.llvm.org/D45619#1075677, @bjope wrote:

> buildbots have been failing all day (and were still failing). So I pushed my 
> suggested fix.
>  I hope that was OK.


Thank you. It seems everything is OK now.


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Nico Weber via cfe-commits
On Mon, Apr 23, 2018 at 11:53 AM, Andrew V. Tischenko via Phabricator via
cfe-commits  wrote:

> avt77 added a comment.
>
> In https://reviews.llvm.org/D45619#1075437, @bjope wrote:
>
> > I can't see that it has been reverted.
> >  But I guess that the table maybe is sorted based on time spent in each
> pass? So that is why it might be sorted differently on different buildbots
> (or when using pipe etc).
> >
> > So I think a quick fix is to add -DAG to the checks that can be reorder
> and submit that fix.
>
>
> I don't see revert as well. But I did the following:
>
> svn merge -c -330571 .
>

That only prepares a revert locally. You need to run `svn commit` after
that to actually land the revert.


>
> And everything was OK.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D45619
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Bjorn Pettersson via Phabricator via cfe-commits
bjope added a comment.

buildbots have been failing all day (and were still failing). So I pushed my 
suggested fix.
I hope that was OK.


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 added a comment.

In https://reviews.llvm.org/D45619#1075437, @bjope wrote:

> I can't see that it has been reverted.
>  But I guess that the table maybe is sorted based on time spent in each pass? 
> So that is why it might be sorted differently on different buildbots (or when 
> using pipe etc).
>
> So I think a quick fix is to add -DAG to the checks that can be reorder and 
> submit that fix.


I don't see revert as well. But I did the following:

svn merge -c -330571 .

And everything was OK.


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Bjorn Pettersson via Phabricator via cfe-commits
bjope added a comment.

I can't see that it has been reverted.
But I guess that the table maybe is sorted based on time spent in each pass? So 
that is why it might be sorted differently on different buildbots (or when 
using pipe etc).

So I think a quick fix is to add -DAG to the checks that can be reorder and 
submit that fix.


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 added a comment.

In https://reviews.llvm.org/D45619#1075385, @bjope wrote:

> Anyway, if the order isn't deteministic, then a solution could be to use 
> CHECK-DAG instead of CHECK for the checks that may be reordered. For example:


Thank you very much! I'll try to fix it in this way.


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 added a comment.

In https://reviews.llvm.org/D45619#1075260, @thakis wrote:

> In any case, when you see a test failing on bots and the fix isn't obvious,
>  revert first to get the bots back green.


I reverted it immediatly.


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Bjorn Pettersson via Phabricator via cfe-commits
bjope added a comment.

In https://reviews.llvm.org/D45619#1075089, @avt77 wrote:

> It's terrible but my new test was failed again as result of commit of this 
> patch!
>
> ///b/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/test/Frontend/ftime-report-template-decl.cpp:155:11:
>  error: expected string not found in input
>  // CHECK: Code Generation Time
>  //  ^
>
> I don't understand how it's possible. The same problem raised when I 
> committed D43578 . Obviously, there is a 
> situation when this  test work w/o Code Generation and as result this test is 
> fail because code generation time is zerro. Could anyone help me? How should 
> I change the test? The simplest way is to remove this line but I don't like 
> this idea.


Not sure, but is perhaps the order in which timers are printed not 100% 
deterministic?
When I run the test "manually" without pipe to FileCheck I get:

  
===-===
   Miscellaneous Ungrouped Timers
  
===-===
  
 --System Time--   --User+System--   ---Wall Time---  --- Name ---
 0.0040 (100.0%)   0.0040 (100.0%)   0.0021 ( 70.7%)  Code Generation Time
 0. (  0.0%)   0. (  0.0%)   0.0009 ( 29.3%)  LLVM IR Generation 
Time
 0.0040 (100.0%)   0.0040 (100.0%)   0.0030 (100.0%)  Total

So when I run it without the pipe "Code Generation Time" is printed before 
"LLVM IR Generation Time".
However, the CHECK:s in the test case are in opposite order.
So I can't really understand why the test passes when I pipe it to FileCheck.

Anyway, if the order isn't deteministic, then a solution could be to use 
CHECK-DAG instead of CHECK for the checks that may be reordered. For example:

  // CHECK: Miscellaneous Ungrouped Timers
  // CHECK-DAG: Code Generation Time
  // CHECK-DAG: LLVM IR Generation Time
  // CHECK: Total
  // CHECK: Clang front-end time report
  // CHECK: Clang front-end timer
  // CHECK: Total

Unless the timers are supposed to be printed in a certain order, then I guess 
you need to add a sort somewhere in the code.


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Nico Weber via cfe-commits
In any case, when you see a test failing on bots and the fix isn't obvious,
revert first to get the bots back green.

On Mon, Apr 23, 2018 at 8:54 AM, Andrew V. Tischenko via Phabricator via
cfe-commits  wrote:

> avt77 reopened this revision.
> avt77 added a comment.
> This revision is now accepted and ready to land.
>
> It's terrible but my new test was failed again as result of commit of this
> patch!
>
> ///b/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/
> clang/test/Frontend/ftime-report-template-decl.cpp:155:11: error:
> expected string not found in input
> // CHECK: Code Generation Time
> //  ^
>
> I don't understand how it's possible. The same problem raised when I
> committed D43578 . Obviously, there is a
> situation when this  test work w/o Code Generation and as result this test
> is fail because code generation time is zerro. Could anyone help me? How
> should I change the test? The simplest way is to remove this line but I
> don't like this idea.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D45619
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 reopened this revision.
avt77 added a comment.
This revision is now accepted and ready to land.

It's terrible but my new test was failed again as result of commit of this 
patch!

///b/sanitizer-x86_64-linux-bootstrap/build/llvm/tools/clang/test/Frontend/ftime-report-template-decl.cpp:155:11:
 error: expected string not found in input
// CHECK: Code Generation Time
//  ^

I don't understand how it's possible. The same problem raised when I committed 
D43578 . Obviously, there is a situation when 
this  test work w/o Code Generation and as result this test is fail because 
code generation time is zerro. Could anyone help me? How should I change the 
test? The simplest way is to remove this line but I don't like this idea.


Repository:
  rL LLVM

https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-23 Thread Andrew V. Tischenko via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL330571: Use special new Clang flag 
FrontendTimesIsEnabled instead of llvm… (authored by avt77, 
committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D45619?vs=143311=143511#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45619

Files:
  cfe/trunk/include/clang/Frontend/Utils.h
  cfe/trunk/lib/CodeGen/BackendUtil.cpp
  cfe/trunk/lib/CodeGen/CodeGenAction.cpp
  cfe/trunk/lib/Frontend/CMakeLists.txt
  cfe/trunk/lib/Frontend/FrontendTiming.cpp
  cfe/trunk/test/Frontend/ftime-report-template-decl.cpp

Index: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp
@@ -126,7 +126,7 @@
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)),
   LinkModules(std::move(LinkModules)) {
-  llvm::TimePassesIsEnabled = TimePasses;
+  FrontendTimesIsEnabled = TimePasses;
 }
 llvm::Module *getModule() const { return Gen->GetModule(); }
 std::unique_ptr takeModule() {
@@ -144,12 +144,12 @@
 
   Context = 
 
-  if (llvm::TimePassesIsEnabled)
+  if (FrontendTimesIsEnabled)
 LLVMIRGeneration.startTimer();
 
   Gen->Initialize(Ctx);
 
-  if (llvm::TimePassesIsEnabled)
+  if (FrontendTimesIsEnabled)
 LLVMIRGeneration.stopTimer();
 }
 
@@ -159,15 +159,15 @@
  "LLVM IR generation of declaration");
 
   // Recurse.
-  if (llvm::TimePassesIsEnabled) {
+  if (FrontendTimesIsEnabled) {
 LLVMIRGenerationRefCount += 1;
 if (LLVMIRGenerationRefCount == 1)
   LLVMIRGeneration.startTimer();
   }
 
   Gen->HandleTopLevelDecl(D);
 
-  if (llvm::TimePassesIsEnabled) {
+  if (FrontendTimesIsEnabled) {
 LLVMIRGenerationRefCount -= 1;
 if (LLVMIRGenerationRefCount == 0)
   LLVMIRGeneration.stopTimer();
@@ -180,12 +180,12 @@
   PrettyStackTraceDecl CrashInfo(D, SourceLocation(),
  Context->getSourceManager(),
  "LLVM IR generation of inline function");
-  if (llvm::TimePassesIsEnabled)
+  if (FrontendTimesIsEnabled)
 LLVMIRGeneration.startTimer();
 
   Gen->HandleInlineFunctionDefinition(D);
 
-  if (llvm::TimePassesIsEnabled)
+  if (FrontendTimesIsEnabled)
 LLVMIRGeneration.stopTimer();
 }
 
@@ -227,15 +227,15 @@
 void HandleTranslationUnit(ASTContext ) override {
   {
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
-if (llvm::TimePassesIsEnabled) {
+if (FrontendTimesIsEnabled) {
   LLVMIRGenerationRefCount += 1;
   if (LLVMIRGenerationRefCount == 1)
 LLVMIRGeneration.startTimer();
 }
 
 Gen->HandleTranslationUnit(C);
 
-if (llvm::TimePassesIsEnabled) {
+if (FrontendTimesIsEnabled) {
   LLVMIRGenerationRefCount -= 1;
   if (LLVMIRGenerationRefCount == 0)
 LLVMIRGeneration.stopTimer();
Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -728,7 +728,7 @@
 
 void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
   std::unique_ptr OS) {
-  TimeRegion Region(llvm::TimePassesIsEnabled ?  : nullptr);
+  TimeRegion Region(FrontendTimesIsEnabled ?  : nullptr);
 
   setCommandLineOpts(CodeGenOpts);
 
@@ -858,7 +858,7 @@
 /// `EmitAssembly` at some point in the future when the default switches.
 void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
 BackendAction Action, std::unique_ptr OS) {
-  TimeRegion Region(llvm::TimePassesIsEnabled ?  : nullptr);
+  TimeRegion Region(FrontendTimesIsEnabled ?  : nullptr);
   setCommandLineOpts(CodeGenOpts);
 
   // The new pass manager always makes a target machine available to passes
Index: cfe/trunk/lib/Frontend/CMakeLists.txt
===
--- cfe/trunk/lib/Frontend/CMakeLists.txt
+++ cfe/trunk/lib/Frontend/CMakeLists.txt
@@ -29,6 +29,7 @@
   FrontendAction.cpp
   FrontendActions.cpp
   FrontendOptions.cpp
+  FrontendTiming.cpp
   HeaderIncludeGen.cpp
   InitHeaderSearch.cpp
   InitPreprocessor.cpp
Index: cfe/trunk/lib/Frontend/FrontendTiming.cpp
===
--- cfe/trunk/lib/Frontend/FrontendTiming.cpp
+++ cfe/trunk/lib/Frontend/FrontendTiming.cpp
@@ -0,0 +1,20 @@
+//===- FronendTiming.cpp - Implements Frontend timing utils  --===//
+//
+// The LLVM Compiler Infrastructure
+//

[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-20 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-20 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 updated this revision to Diff 143311.
avt77 added a comment.

I fixed issues raised by efriedma.


https://reviews.llvm.org/D45619

Files:
  include/clang/Frontend/Utils.h
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CodeGenAction.cpp
  lib/Frontend/CMakeLists.txt
  lib/Frontend/FrontendTiming.cpp
  test/Frontend/ftime-report-template-decl.cpp

Index: test/Frontend/ftime-report-template-decl.cpp
===
--- test/Frontend/ftime-report-template-decl.cpp
+++ test/Frontend/ftime-report-template-decl.cpp
@@ -0,0 +1,159 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -ftime-report  2>&1 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING -ftime-report  2>&1 | FileCheck %s
+
+// Template function declarations
+template 
+void foo();
+template 
+void foo();
+
+// Template function definitions.
+template 
+void foo() {}
+
+// Template class (forward) declarations
+template 
+struct A;
+template 
+struct b;
+template 
+struct C;
+template 
+struct D;
+
+// Forward declarations with default parameters?
+template 
+class X1;
+template 
+class X2;
+
+// Forward declarations w/template template parameters
+template  class T>
+class TTP1;
+template  class>
+class TTP2;
+template  class T>
+class TTP5;
+
+// Forward declarations with non-type params
+template 
+class NTP0;
+template 
+class NTP1;
+template 
+class NTP2;
+template 
+class NTP3;
+template 
+class NTP4;
+template 
+class NTP5;
+template 
+class NTP6;
+template 
+class NTP7;
+
+// Template class declarations
+template 
+struct A {};
+template 
+struct B {};
+
+namespace PR6184 {
+namespace N {
+template 
+void bar(typename T::x);
+}
+
+template 
+void N::bar(typename T::x) {}
+}
+
+// This PR occurred only in template parsing mode.
+namespace PR17637 {
+template 
+struct L {
+  template 
+  struct O {
+template 
+static void Fun(U);
+  };
+};
+
+template 
+template 
+template 
+void L::O::Fun(U) {}
+
+void Instantiate() { L<0>::O::Fun(0); }
+}
+
+namespace explicit_partial_specializations {
+typedef char ()[1];
+typedef char ()[2];
+typedef char ()[3];
+typedef char ()[4];
+typedef char ()[5];
+typedef char ()[6];
+
+char one[1];
+char two[2];
+char three[3];
+char four[4];
+char five[5];
+char six[6];
+
+template 
+struct bool_ { typedef int type; };
+template <>
+struct bool_ {};
+
+#define XCAT(x, y) x##y
+#define CAT(x, y) XCAT(x, y)
+#define sassert(_b_) bool_<(_b_)>::type CAT(var, __LINE__);
+
+template 
+struct L {
+  template 
+  struct O {
+template 
+static oneT Fun(U);
+  };
+};
+template 
+template 
+template 
+oneT L::O::Fun(U) { return one; }
+
+template <>
+template <>
+template 
+oneT L<0>::O::Fun(U) { return one; }
+
+void Instantiate() {
+  sassert(sizeof(L<0>::O::Fun(0)) == sizeof(one));
+  sassert(sizeof(L<0>::O::Fun(0)) == sizeof(one));
+}
+}
+
+template 
+struct Foo {
+  template 
+  using rebind_alloc = _Other;
+};
+template 
+struct _Wrap_alloc {
+  template 
+  using rebind_alloc = typename Foo<_Alloc>::template rebind_alloc<_Other>;
+  template 
+  using rebind = _Wrap_alloc;
+};
+_Wrap_alloc::rebind w;
+
+// CHECK: Miscellaneous Ungrouped Timers
+// CHECK: LLVM IR Generation Time
+// CHECK: Code Generation Time
+// CHECK: Total
+// CHECK: Clang front-end time report
+// CHECK: Clang front-end timer
+// CHECK: Total
Index: lib/Frontend/FrontendTiming.cpp
===
--- lib/Frontend/FrontendTiming.cpp
+++ lib/Frontend/FrontendTiming.cpp
@@ -0,0 +1,20 @@
+//===- FronendTiming.cpp - Implements Frontend timing utils  --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file keps implementation of frontend timing utils.
+//
+//===--===//
+
+#include "clang/Frontend/Utils.h"
+
+namespace clang {
+
+bool FrontendTimesIsEnabled = false;
+
+}
Index: lib/Frontend/CMakeLists.txt
===
--- lib/Frontend/CMakeLists.txt
+++ lib/Frontend/CMakeLists.txt
@@ -29,6 +29,7 @@
   FrontendAction.cpp
   FrontendActions.cpp
   FrontendOptions.cpp
+  FrontendTiming.cpp
   HeaderIncludeGen.cpp
   InitHeaderSearch.cpp
   InitPreprocessor.cpp
Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -126,7 +126,7 @@
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)),
   LinkModules(std::move(LinkModules)) {
-  llvm::TimePassesIsEnabled = TimePasses;
+  

[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-20 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 added inline comments.



Comment at: test/Frontend/ftime-report-template-decl.cpp:2
+// RUN: %clang %s -S -o - -ftime-report  2>&1 | FileCheck %s
+// RUN: %clang %s -S -o - -fdelayed-template-parsing 
-DDELAYED_TEMPLATE_PARSING -ftime-report  2>&1 | FileCheck %s
+

efriedma wrote:
> What is this test supposed to be testing?  If you're just checking that we 
> output the timers, this doesn't need to be so complicated.
> 
> We generally prefer to use %clang_cc1 for tests like this.
> 
> Please use -emit-llvm instead of -S if you don't actually need assembly.
You wrote "What is this test supposed to be testing? If you're just checking 
that we output the timers, this doesn't need to be so complicated."
I'm going to use this test to show new timers soon that's why it looks so 
complicated at the first glance. At the moment it simply checking the output of 
the existing counter but later it will show the new counters.


https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-19 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: lib/Frontend/FrontendTiming.cpp:14
+
+#include "llvm/Support/Timer.h"
+

This should include clang/Frontend/Utils.h .



Comment at: test/Frontend/ftime-report-template-decl.cpp:2
+// RUN: %clang %s -S -o - -ftime-report  2>&1 | FileCheck %s
+// RUN: %clang %s -S -o - -fdelayed-template-parsing 
-DDELAYED_TEMPLATE_PARSING -ftime-report  2>&1 | FileCheck %s
+

What is this test supposed to be testing?  If you're just checking that we 
output the timers, this doesn't need to be so complicated.

We generally prefer to use %clang_cc1 for tests like this.

Please use -emit-llvm instead of -S if you don't actually need assembly.


https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-19 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 added a comment.

Hi All,
Are there other issues related to this patch?
If NO could anyone give me LGTM? I need this patch committed to continue with 
recursive time counters.


https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-17 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 updated this revision to Diff 142755.
avt77 added a comment.

I moved FrontendTiming.cpp from lib/Basic/ to lib/Frontend/.


https://reviews.llvm.org/D45619

Files:
  include/clang/Frontend/Utils.h
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CodeGenAction.cpp
  lib/Frontend/CMakeLists.txt
  lib/Frontend/FrontendTiming.cpp
  test/Frontend/ftime-report-template-decl.cpp

Index: test/Frontend/ftime-report-template-decl.cpp
===
--- test/Frontend/ftime-report-template-decl.cpp
+++ test/Frontend/ftime-report-template-decl.cpp
@@ -0,0 +1,159 @@
+// RUN: %clang %s -S -o - -ftime-report  2>&1 | FileCheck %s
+// RUN: %clang %s -S -o - -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING -ftime-report  2>&1 | FileCheck %s
+
+// Template function declarations
+template 
+void foo();
+template 
+void foo();
+
+// Template function definitions.
+template 
+void foo() {}
+
+// Template class (forward) declarations
+template 
+struct A;
+template 
+struct b;
+template 
+struct C;
+template 
+struct D;
+
+// Forward declarations with default parameters?
+template 
+class X1;
+template 
+class X2;
+
+// Forward declarations w/template template parameters
+template  class T>
+class TTP1;
+template  class>
+class TTP2;
+template  class T>
+class TTP5;
+
+// Forward declarations with non-type params
+template 
+class NTP0;
+template 
+class NTP1;
+template 
+class NTP2;
+template 
+class NTP3;
+template 
+class NTP4;
+template 
+class NTP5;
+template 
+class NTP6;
+template 
+class NTP7;
+
+// Template class declarations
+template 
+struct A {};
+template 
+struct B {};
+
+namespace PR6184 {
+namespace N {
+template 
+void bar(typename T::x);
+}
+
+template 
+void N::bar(typename T::x) {}
+}
+
+// This PR occurred only in template parsing mode.
+namespace PR17637 {
+template 
+struct L {
+  template 
+  struct O {
+template 
+static void Fun(U);
+  };
+};
+
+template 
+template 
+template 
+void L::O::Fun(U) {}
+
+void Instantiate() { L<0>::O::Fun(0); }
+}
+
+namespace explicit_partial_specializations {
+typedef char ()[1];
+typedef char ()[2];
+typedef char ()[3];
+typedef char ()[4];
+typedef char ()[5];
+typedef char ()[6];
+
+char one[1];
+char two[2];
+char three[3];
+char four[4];
+char five[5];
+char six[6];
+
+template 
+struct bool_ { typedef int type; };
+template <>
+struct bool_ {};
+
+#define XCAT(x, y) x##y
+#define CAT(x, y) XCAT(x, y)
+#define sassert(_b_) bool_<(_b_)>::type CAT(var, __LINE__);
+
+template 
+struct L {
+  template 
+  struct O {
+template 
+static oneT Fun(U);
+  };
+};
+template 
+template 
+template 
+oneT L::O::Fun(U) { return one; }
+
+template <>
+template <>
+template 
+oneT L<0>::O::Fun(U) { return one; }
+
+void Instantiate() {
+  sassert(sizeof(L<0>::O::Fun(0)) == sizeof(one));
+  sassert(sizeof(L<0>::O::Fun(0)) == sizeof(one));
+}
+}
+
+template 
+struct Foo {
+  template 
+  using rebind_alloc = _Other;
+};
+template 
+struct _Wrap_alloc {
+  template 
+  using rebind_alloc = typename Foo<_Alloc>::template rebind_alloc<_Other>;
+  template 
+  using rebind = _Wrap_alloc;
+};
+_Wrap_alloc::rebind w;
+
+// CHECK: Miscellaneous Ungrouped Timers
+// CHECK: Code Generation Time
+// CHECK: LLVM IR Generation Time
+// CHECK: Total
+// CHECK: Clang front-end time report
+// CHECK: Clang front-end timer
+// CHECK: Total
Index: lib/Frontend/FrontendTiming.cpp
===
--- lib/Frontend/FrontendTiming.cpp
+++ lib/Frontend/FrontendTiming.cpp
@@ -0,0 +1,20 @@
+//===- FronendTiming.cpp - Implements Frontend timing utils  --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file keps implementation of frontend timing utils.
+//
+//===--===//
+
+#include "llvm/Support/Timer.h"
+
+namespace clang {
+
+bool FrontendTimesIsEnabled = false;
+
+}
Index: lib/Frontend/CMakeLists.txt
===
--- lib/Frontend/CMakeLists.txt
+++ lib/Frontend/CMakeLists.txt
@@ -29,6 +29,7 @@
   FrontendAction.cpp
   FrontendActions.cpp
   FrontendOptions.cpp
+  FrontendTiming.cpp
   HeaderIncludeGen.cpp
   InitHeaderSearch.cpp
   InitPreprocessor.cpp
Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -126,7 +126,7 @@
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)),
   LinkModules(std::move(LinkModules)) {
-  llvm::TimePassesIsEnabled = TimePasses;
+  

[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-16 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: lib/Basic/FrontendTiming.cpp:18
+
+bool FrontendTimesIsEnabled = false;
+

avt77 wrote:
> efriedma wrote:
> > Why is this in lib/Basic, when the declaration is in 
> > include/clang/Frontend/?
> Because this library is being linked to all others and as result this global 
> variable could be seen in any Clang library w/o any changes in config files. 
> Or you mean it should be moved from Frontend? But where? It's a frontend 
> feature that's why I put its declaration there.
The include structure should match the library structure; if the definition 
needs to be in lib/Basic/, the declaration should be in include/clang/Basic.


https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-14 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 added inline comments.



Comment at: lib/Basic/FrontendTiming.cpp:18
+
+bool FrontendTimesIsEnabled = false;
+

efriedma wrote:
> Why is this in lib/Basic, when the declaration is in include/clang/Frontend/?
Because this library is being linked to all others and as result this global 
variable could be seen in any Clang library w/o any changes in config files. Or 
you mean it should be moved from Frontend? But where? It's a frontend feature 
that's why I put its declaration there.


https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-13 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

This makes sense.




Comment at: include/clang/Frontend/Utils.h:241
+/// then the value of this boolean will be true, otherwise false.
+extern bool FrontendTimesIsEnabled;
+

Don't really like global variables, but I guess timers are global state anyway, 
so this isn't really making anything worse.



Comment at: lib/Basic/FrontendTiming.cpp:18
+
+bool FrontendTimesIsEnabled = false;
+

Why is this in lib/Basic, when the declaration is in include/clang/Frontend/?


https://reviews.llvm.org/D45619



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45619: [Time-report] (1) Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature

2018-04-13 Thread Andrew V. Tischenko via Phabricator via cfe-commits
avt77 created this revision.
avt77 added reviewers: mgorny, russell.gallop, efriedma, rsmith, thakis, 
davezarzycki, RKSimon, simon.f.whittaker.

To simplify the review and commit of D43578  I 
decided to spilt it in several small parts.

This patch is the first part of the new series of patches. This patch 
introduces a dedicated boolean to deal with -ftime-report Clang switch (instead 
of 'llvm::TimePassesIsEnabled' which was LLVM dependent and potentionally could 
increase Clang compilation time).

Next patch will show usage of llvm::NamedRegionTimer instead of 
llvm::TimeRegion - it will really improve the generating output of the given 
feature.

Then I'll show the new class to deal with reqursive time counters (instead of 
approach shown in CodeGenAction.cpp).

And then we'll try new time counters (Preprocessor, Include Files, Parsing, 
Sema, CodeGen, etc.) The final list of counters will grow in dpendence of 
possible future requirements.

Finally, I'm going to introduce the feature which is similar to this one 
.

Hope, all these efforts could be interesting for many of us.


https://reviews.llvm.org/D45619

Files:
  include/clang/Frontend/Utils.h
  lib/Basic/CMakeLists.txt
  lib/Basic/FrontendTiming.cpp
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CodeGenAction.cpp
  test/Frontend/ftime-report-template-decl.cpp

Index: test/Frontend/ftime-report-template-decl.cpp
===
--- test/Frontend/ftime-report-template-decl.cpp
+++ test/Frontend/ftime-report-template-decl.cpp
@@ -0,0 +1,159 @@
+// RUN: %clang %s -S -o - -ftime-report  2>&1 | FileCheck %s
+// RUN: %clang %s -S -o - -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING -ftime-report  2>&1 | FileCheck %s
+
+// Template function declarations
+template 
+void foo();
+template 
+void foo();
+
+// Template function definitions.
+template 
+void foo() {}
+
+// Template class (forward) declarations
+template 
+struct A;
+template 
+struct b;
+template 
+struct C;
+template 
+struct D;
+
+// Forward declarations with default parameters?
+template 
+class X1;
+template 
+class X2;
+
+// Forward declarations w/template template parameters
+template  class T>
+class TTP1;
+template  class>
+class TTP2;
+template  class T>
+class TTP5;
+
+// Forward declarations with non-type params
+template 
+class NTP0;
+template 
+class NTP1;
+template 
+class NTP2;
+template 
+class NTP3;
+template 
+class NTP4;
+template 
+class NTP5;
+template 
+class NTP6;
+template 
+class NTP7;
+
+// Template class declarations
+template 
+struct A {};
+template 
+struct B {};
+
+namespace PR6184 {
+namespace N {
+template 
+void bar(typename T::x);
+}
+
+template 
+void N::bar(typename T::x) {}
+}
+
+// This PR occurred only in template parsing mode.
+namespace PR17637 {
+template 
+struct L {
+  template 
+  struct O {
+template 
+static void Fun(U);
+  };
+};
+
+template 
+template 
+template 
+void L::O::Fun(U) {}
+
+void Instantiate() { L<0>::O::Fun(0); }
+}
+
+namespace explicit_partial_specializations {
+typedef char ()[1];
+typedef char ()[2];
+typedef char ()[3];
+typedef char ()[4];
+typedef char ()[5];
+typedef char ()[6];
+
+char one[1];
+char two[2];
+char three[3];
+char four[4];
+char five[5];
+char six[6];
+
+template 
+struct bool_ { typedef int type; };
+template <>
+struct bool_ {};
+
+#define XCAT(x, y) x##y
+#define CAT(x, y) XCAT(x, y)
+#define sassert(_b_) bool_<(_b_)>::type CAT(var, __LINE__);
+
+template 
+struct L {
+  template 
+  struct O {
+template 
+static oneT Fun(U);
+  };
+};
+template 
+template 
+template 
+oneT L::O::Fun(U) { return one; }
+
+template <>
+template <>
+template 
+oneT L<0>::O::Fun(U) { return one; }
+
+void Instantiate() {
+  sassert(sizeof(L<0>::O::Fun(0)) == sizeof(one));
+  sassert(sizeof(L<0>::O::Fun(0)) == sizeof(one));
+}
+}
+
+template 
+struct Foo {
+  template 
+  using rebind_alloc = _Other;
+};
+template 
+struct _Wrap_alloc {
+  template 
+  using rebind_alloc = typename Foo<_Alloc>::template rebind_alloc<_Other>;
+  template 
+  using rebind = _Wrap_alloc;
+};
+_Wrap_alloc::rebind w;
+
+// CHECK: Miscellaneous Ungrouped Timers
+// CHECK: Code Generation Time
+// CHECK: LLVM IR Generation Time
+// CHECK: Total
+// CHECK: Clang front-end time report
+// CHECK: Clang front-end timer
+// CHECK: Total
Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -126,7 +126,7 @@
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)),
   LinkModules(std::move(LinkModules)) {
-  llvm::TimePassesIsEnabled = TimePasses;
+  FrontendTimesIsEnabled = TimePasses;
 }
 llvm::Module *getModule() const { return