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

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 07:43:57 PDT 2018


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 <https://reviews.llvm.org/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.0000 (  0.0%)   0.0000 (  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





More information about the llvm-commits mailing list