[PATCH] D48109: [Timers] Use the pass argument name for JSON keys in time-passes

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 13 13:14:36 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL334649: [Timers] Use the pass argument name for JSON keys in time-passes (authored by thegameg, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D48109?vs=151074&id=151236#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D48109

Files:
  llvm/trunk/lib/IR/LegacyPassManager.cpp
  llvm/trunk/test/CodeGen/X86/time-passes-json-stats.ll


Index: llvm/trunk/lib/IR/LegacyPassManager.cpp
===================================================================
--- llvm/trunk/lib/IR/LegacyPassManager.cpp
+++ llvm/trunk/lib/IR/LegacyPassManager.cpp
@@ -545,7 +545,11 @@
     Timer *&T = TimingData[P];
     if (!T) {
       StringRef PassName = P->getPassName();
-      T = new Timer(PassName, PassName, TG);
+      StringRef PassArgument;
+      if (const PassInfo *PI = Pass::lookupPassInfo(P->getPassID()))
+        PassArgument = PI->getPassArgument();
+      T = new Timer(PassArgument.empty() ? PassName : PassArgument, PassName,
+                    TG);
     }
     return T;
   }
Index: llvm/trunk/test/CodeGen/X86/time-passes-json-stats.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/time-passes-json-stats.ll
+++ llvm/trunk/test/CodeGen/X86/time-passes-json-stats.ll
@@ -0,0 +1,14 @@
+; RUN: llc -mtriple=x86_64-- -stats-json=true -stats -time-passes %s -o /dev/null 2>&1 | FileCheck %s
+
+; Verify that we use the argument pass name instead of the full name as a json
+; key for timers.
+;
+; CHECK: {
+; CHECK-NEXT: "asm-printer.EmittedInsts":
+; CHECK-NOT: Virtual Register Map
+; CHECK: "time.pass.virtregmap.wall":
+; CHECK: "time.pass.virtregmap.user":
+; CHECK: "time.pass.virtregmap.sys":
+; CHECK: Virtual Register Map
+
+define void @test_stats() { ret void }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48109.151236.patch
Type: text/x-patch
Size: 1391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180613/cb76fe9b/attachment.bin>


More information about the llvm-commits mailing list