[llvm] r350670 - [PGO] Revert r350579 to fix commit message.

Rong Xu via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 8 14:37:13 PST 2019


Author: xur
Date: Tue Jan  8 14:37:12 2019
New Revision: 350670

URL: http://llvm.org/viewvc/llvm-project?rev=350670&view=rev
Log:
[PGO] Revert r350579 to fix commit message.

Will re-commit it using the correct commit message.

Removed:
    llvm/trunk/test/tools/llvm-profdata/Inputs/cutoff.proftext
    llvm/trunk/test/tools/llvm-profdata/cutoff.test
Modified:
    llvm/trunk/docs/CommandGuide/llvm-profdata.rst
    llvm/trunk/test/tools/llvm-profdata/value-prof.proftext
    llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp

Modified: llvm/trunk/docs/CommandGuide/llvm-profdata.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-profdata.rst?rev=350670&r1=350669&r2=350670&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-profdata.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-profdata.rst Tue Jan  8 14:37:12 2019
@@ -203,7 +203,7 @@ OPTIONS
  annotations.
 
 .. option:: -topn=n
-
+	     
  Instruct the profile dumper to show the top ``n`` functions with the
  hottest basic blocks in the summary section. By default, the topn functions
  are not dumped.
@@ -216,16 +216,6 @@ OPTIONS
 
  Show the profiled sizes of the memory intrinsic calls for shown functions.
 
-.. option:: -value-cutoff=n
-
- Show only those functions whose max count values are greater or equal to ``n``.
- By default, the value-cutoff is set to 0.
-
-.. option:: -list-below-cutoff
-
- Only output names of functions whose max count value are below the cutoff
- value.
-
 EXIT STATUS
 -----------
 

Removed: llvm/trunk/test/tools/llvm-profdata/Inputs/cutoff.proftext
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/Inputs/cutoff.proftext?rev=350669&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/Inputs/cutoff.proftext (original)
+++ llvm/trunk/test/tools/llvm-profdata/Inputs/cutoff.proftext (removed)
@@ -1,21 +0,0 @@
-# IR level Instrumentation Flag
-:ir
-bar
-10
-2
-0
-0
-
-main
-16650
-4
-1
-1000
-1000000
-499500
-
-foo
-10
-2
-999
-1

Removed: llvm/trunk/test/tools/llvm-profdata/cutoff.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/cutoff.test?rev=350669&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/cutoff.test (original)
+++ llvm/trunk/test/tools/llvm-profdata/cutoff.test (removed)
@@ -1,23 +0,0 @@
-Basic tests for cutoff options in show command.
-
-RUN: llvm-profdata show -value-cutoff=1 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefix=CUTOFF1 -check-prefix=CHECK
-RUN: llvm-profdata show -value-cutoff=1000 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefix=CUTOFF1000 -check-prefix=CHECK
-RUN: llvm-profdata show -all-functions -value-cutoff=1 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefix=CUTOFF1FUNC -check-prefix=CUTOFF1 -check-prefix=CHECK
-RUN: llvm-profdata show -all-functions -value-cutoff=1000 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefix=CUTOFF1000FUNC -check-prefix=CUTOFF1000 -check-prefix=CHECK
-RUN: llvm-profdata show -value-cutoff=1 -list-below-cutoff %p/Inputs/cutoff.proftext | FileCheck %s -check-prefix=BELOW1 -check-prefix=CUTOFF1 -check-prefix=CHECK
-RUN: llvm-profdata show -value-cutoff=1000 -list-below-cutoff %p/Inputs/cutoff.proftext | FileCheck %s -check-prefix=BELOW1000 -check-prefix=CUTOFF1000 -check-prefix=CHECK
-CUTOFF1FUNC-NOT: bar
-CUTOFF1FUNC: Functions shown: 2
-CUTOFF1000FUNC-NOT: bar
-CUTOFF1000FUNC-NOT: foo
-CUTOFF1000FUNC: Functions shown: 1
-BELOW1: The list of functions with the maximum counter less than 1:
-BELOW1:  bar: (Max = 0 Sum = 0)
-BELOW1000:The list of functions with the maximum counter less than 1000:
-BELOW1000:  bar: (Max = 0 Sum = 0)
-BELOW1000:  foo: (Max = 999 Sum = 1000)
-CHECK: Total functions: 3
-CUTOFF1: Number of functions with maximum count (< 1): 1
-CUTOFF1: Number of functions with maximum count (>= 1): 2
-CUTOFF1000: Number of functions with maximum count (< 1000): 2
-CUTOFF1000: Number of functions with maximum count (>= 1000): 1

Modified: llvm/trunk/test/tools/llvm-profdata/value-prof.proftext
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/value-prof.proftext?rev=350670&r1=350669&r2=350670&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/value-prof.proftext (original)
+++ llvm/trunk/test/tools/llvm-profdata/value-prof.proftext Tue Jan  8 14:37:12 2019
@@ -47,9 +47,9 @@ foo2:20000
 
 #ICTXT: Indirect Call Site Count: 3
 #ICTXT-NEXT:    Indirect Target Results:
-#ICTXT-NEXT:	[ 1, foo, 100 ] (9.09%)
-#ICTXT-NEXT:	[ 1, foo2, 1000 ] (90.91%)
-#ICTXT-NEXT:	[ 2, foo2, 20000 ] (100.00%)
+#ICTXT-NEXT:	[ 1, foo, 100 ]
+#ICTXT-NEXT:	[ 1, foo2, 1000 ]
+#ICTXT-NEXT:	[ 2, foo2, 20000 ]
 
 #IC: Indirect Call Site Count: 3
 #IC-NEXT:    Indirect Target Results:

Modified: llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp?rev=350670&r1=350669&r2=350670&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp (original)
+++ llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp Tue Jan  8 14:37:12 2019
@@ -633,21 +633,13 @@ static void traverseAllValueSites(const
         Stats.ValueSitesHistogram.resize(NV, 0);
       Stats.ValueSitesHistogram[NV - 1]++;
     }
-
-    uint64_t SiteSum = 0;
-    for (uint32_t V = 0; V < NV; V++)
-      SiteSum += VD[V].Count;
-    if (SiteSum == 0)
-      SiteSum = 1;
-
     for (uint32_t V = 0; V < NV; V++) {
-      OS << "\t[ " << format("%2u", I) << ", ";
+      OS << "\t[ " << I << ", ";
       if (Symtab == nullptr)
-        OS << format("%4u", VD[V].Value);
+        OS << VD[V].Value;
       else
         OS << Symtab->getFuncName(VD[V].Value);
-      OS << ", " << format("%10" PRId64, VD[V].Count) << " ] ("
-         << format("%.2f%%", (VD[V].Count * 100.0 / SiteSum)) << ")\n";
+      OS << ", " << VD[V].Count << " ]\n";
     }
   }
 }
@@ -670,9 +662,9 @@ static int showInstrProfile(const std::s
                             uint32_t TopN, bool ShowIndirectCallTargets,
                             bool ShowMemOPSizes, bool ShowDetailedSummary,
                             std::vector<uint32_t> DetailedSummaryCutoffs,
-                            bool ShowAllFunctions, uint64_t ValueCutoff,
-                            bool OnlyListBelow, const std::string &ShowFunction,
-                            bool TextFormat, raw_fd_ostream &OS) {
+                            bool ShowAllFunctions,
+                            const std::string &ShowFunction, bool TextFormat,
+                            raw_fd_ostream &OS) {
   auto ReaderOrErr = InstrProfReader::create(Filename);
   std::vector<uint32_t> Cutoffs = std::move(DetailedSummaryCutoffs);
   if (ShowDetailedSummary && Cutoffs.empty()) {
@@ -685,7 +677,6 @@ static int showInstrProfile(const std::s
   auto Reader = std::move(ReaderOrErr.get());
   bool IsIRInstr = Reader->isIRLevelProfile();
   size_t ShownFunctions = 0;
-  size_t BelowCutoffFunctions = 0;
   int NumVPKind = IPVK_Last - IPVK_First + 1;
   std::vector<ValueSitesStats> VPStats(NumVPKind);
 
@@ -699,11 +690,6 @@ static int showInstrProfile(const std::s
                       decltype(MinCmp)>
       HottestFuncs(MinCmp);
 
-  if (!TextFormat && OnlyListBelow) {
-    OS << "The list of functions with the maximum counter less than "
-       << ValueCutoff << ":\n";
-  }
-
   // Add marker so that IR-level instrumentation round-trips properly.
   if (TextFormat && IsIRInstr)
     OS << ":ir\n";
@@ -725,24 +711,11 @@ static int showInstrProfile(const std::s
     assert(Func.Counts.size() > 0 && "function missing entry counter");
     Builder.addRecord(Func);
 
-    uint64_t FuncMax = 0;
-    uint64_t FuncSum = 0;
-    for (size_t I = 0, E = Func.Counts.size(); I < E; ++I) {
-      FuncMax = std::max(FuncMax, Func.Counts[I]);
-      FuncSum += Func.Counts[I];
-    }
-
-    if (FuncMax < ValueCutoff) {
-      ++BelowCutoffFunctions;
-      if (OnlyListBelow) {
-        OS << "  " << Func.Name << ": (Max = " << FuncMax
-           << " Sum = " << FuncSum << ")\n";
-      }
-      continue;
-    } else if (OnlyListBelow)
-      continue;
-
     if (TopN) {
+      uint64_t FuncMax = 0;
+      for (size_t I = 0, E = Func.Counts.size(); I < E; ++I)
+        FuncMax = std::max(FuncMax, Func.Counts[I]);
+
       if (HottestFuncs.size() == TopN) {
         if (HottestFuncs.top().second < FuncMax) {
           HottestFuncs.pop();
@@ -753,6 +726,7 @@ static int showInstrProfile(const std::s
     }
 
     if (Show) {
+
       if (!ShownFunctions)
         OS << "Counters:\n";
 
@@ -807,12 +781,6 @@ static int showInstrProfile(const std::s
   if (ShowAllFunctions || !ShowFunction.empty())
     OS << "Functions shown: " << ShownFunctions << "\n";
   OS << "Total functions: " << PS->getNumFunctions() << "\n";
-  if (ValueCutoff > 0) {
-    OS << "Number of functions with maximum count (< " << ValueCutoff
-       << "): " << BelowCutoffFunctions << "\n";
-    OS << "Number of functions with maximum count (>= " << ValueCutoff
-       << "): " << PS->getNumFunctions() - BelowCutoffFunctions << "\n";
-  }
   OS << "Maximum function count: " << PS->getMaxFunctionCount() << "\n";
   OS << "Maximum internal block count: " << PS->getMaxInternalCount() << "\n";
 
@@ -914,14 +882,7 @@ static int show_main(int argc, const cha
   cl::opt<uint32_t> TopNFunctions(
       "topn", cl::init(0),
       cl::desc("Show the list of functions with the largest internal counts"));
-  cl::opt<uint32_t> ValueCutoff(
-      "value-cutoff", cl::init(0),
-      cl::desc("Set the count value cutoff. Functions with the maximum count "
-               "less than this value will not be printed out. (Default is 0)"));
-  cl::opt<bool> OnlyListBelow(
-      "list-below-cutoff", cl::init(false),
-      cl::desc("Only output names of functions whose max count values are "
-               "below the cutoff value"));
+
   cl::ParseCommandLineOptions(argc, argv, "LLVM profile data summary\n");
 
   if (OutputFilename.empty())
@@ -941,8 +902,7 @@ static int show_main(int argc, const cha
     return showInstrProfile(Filename, ShowCounts, TopNFunctions,
                             ShowIndirectCallTargets, ShowMemOPSizes,
                             ShowDetailedSummary, DetailedSummaryCutoffs,
-                            ShowAllFunctions, ValueCutoff, OnlyListBelow,
-                            ShowFunction, TextFormat, OS);
+                            ShowAllFunctions, ShowFunction, TextFormat, OS);
   else
     return showSampleProfile(Filename, ShowCounts, ShowAllFunctions,
                              ShowFunction, OS);




More information about the llvm-commits mailing list