[PATCH] D86266: [Attributor][NFC] Make "Attributor" the time scope and use "details"

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 23:17:01 PDT 2020


jdoerfert created this revision.
jdoerfert added a reviewer: kuter.
Herald added subscribers: okura, uenoku, bollu, hiraditya.
Herald added a reviewer: uenoku.
Herald added a reviewer: homerdin.
Herald added a project: LLVM.
jdoerfert requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a subscriber: bbn.

The time scope allows to have a name and "details". Before we encoded
everything into the name, now we use "details" to distinguish the
methods and attributes but keep everything under the "Attributor" name.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86266

Files:
  llvm/include/llvm/Transforms/IPO/Attributor.h
  llvm/lib/Transforms/IPO/Attributor.cpp


Index: llvm/lib/Transforms/IPO/Attributor.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Attributor.cpp
+++ llvm/lib/Transforms/IPO/Attributor.cpp
@@ -940,7 +940,7 @@
 }
 
 void Attributor::runTillFixpoint() {
-  TimeTraceScope TimeScope("Attributor::runTillFixpoint");
+  TimeTraceScope TimeScope("Attributor", StringRef("runTillFixpoint"));
   LLVM_DEBUG(dbgs() << "[Attributor] Identified and initialized "
                     << DG.SyntheticRoot.Deps.size()
                     << " abstract attributes.\n");
@@ -1077,7 +1077,7 @@
 }
 
 ChangeStatus Attributor::manifestAttributes() {
-  TimeTraceScope TimeScope("Attributor::manifestAttributes");
+  TimeTraceScope TimeScope("Attributor", StringRef("manifestAttributes"));
   size_t NumFinalAAs = DG.SyntheticRoot.Deps.size();
 
   unsigned NumManifested = 0;
@@ -1102,7 +1102,12 @@
     if (isAssumedDead(*AA, nullptr, /* CheckBBLivenessOnly */ true))
       continue;
     // Manifest the state and record if we changed the IR.
-    ChangeStatus LocalChange = AA->manifest(*this);
+    ChangeStatus LocalChange;
+    {
+      TimeTraceScope TimeScope("Attributor",
+                               [&]() { return "manifest " + AA->getName(); });
+      LocalChange = AA->manifest(*this);
+    }
     if (LocalChange == ChangeStatus::CHANGED && AreStatisticsEnabled())
       AA->trackStatistics();
     LLVM_DEBUG(dbgs() << "[Attributor] Manifest " << LocalChange << " : " << *AA
@@ -1140,7 +1145,7 @@
 }
 
 ChangeStatus Attributor::cleanupIR() {
-  TimeTraceScope TimeScope("Attributor::cleanupIR");
+  TimeTraceScope TimeScope("Attributor", StringRef("cleanupIR"));
   // Delete stuff at the end to avoid invalid references and a nice order.
   LLVM_DEBUG(dbgs() << "\n[Attributor] Delete at least "
                     << ToBeDeletedFunctions.size() << " functions and "
@@ -1309,7 +1314,7 @@
 }
 
 ChangeStatus Attributor::run() {
-  TimeTraceScope TimeScope("Attributor::run");
+  TimeTraceScope TimeScope("Attributor", StringRef("run"));
 
   SeedingPeriod = false;
   runTillFixpoint();
@@ -1330,7 +1335,8 @@
 }
 
 ChangeStatus Attributor::updateAA(AbstractAttribute &AA) {
-  TimeTraceScope TimeScope(AA.getName() + "::updateAA");
+  TimeTraceScope TimeScope("Attributor",
+                           [&]() { return "update " + AA.getName(); });
 
   // Use a new dependence vector for this update.
   DependenceVector DV;
@@ -1870,6 +1876,9 @@
   if (F.isDeclaration())
     return;
 
+  TimeTraceScope TimeScope("Attributor",
+                           StringRef("identifyDefaultAbstractAttributes"));
+
   // In non-module runs we need to look at the call sites of a function to
   // determine if it is part of a must-tail call edge. This will influence what
   // attributes we can derive.
Index: llvm/include/llvm/Transforms/IPO/Attributor.h
===================================================================
--- llvm/include/llvm/Transforms/IPO/Attributor.h
+++ llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1009,7 +1009,8 @@
     }
 
     {
-      TimeTraceScope TimeScope(AA.getName() + "::initialize");
+      TimeTraceScope TimeScope("Attributor",
+                               [&]() { return "initialize " + AA.getName(); });
       AA.initialize(*this);
     }
     // We can initialize (=look at) code outside the current function set but


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86266.286715.patch
Type: text/x-patch
Size: 3381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200820/e20b3273/attachment.bin>


More information about the llvm-commits mailing list