[llvm] [nfc][llvm-profdata]Refactor llvm-profdata showInstrProfile (PR #71328)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 13:42:48 PST 2023


================
@@ -2420,14 +2429,97 @@ static void showValueSitesStats(raw_fd_ostream &OS, uint32_t VK,
   }
 }
 
-static int showInstrProfile(
-    const std::string &Filename, bool ShowCounts, uint32_t TopN,
-    bool ShowIndirectCallTargets, bool ShowMemOPSizes, bool ShowDetailedSummary,
-    std::vector<uint32_t> DetailedSummaryCutoffs, bool ShowAllFunctions,
-    bool ShowCS, uint64_t ValueCutoff, bool OnlyListBelow,
-    const std::string &ShowFunction, bool TextFormat, bool ShowBinaryIds,
-    bool ShowCovered, bool ShowProfileVersion, bool ShowTemporalProfTraces,
-    ShowFormat SFormat, raw_fd_ostream &OS) {
+static void
+showFuncPseudoCounters(const NamedInstrProfRecord &FuncRecord,
+                       const InstrProfRecord::CountPseudoKind PseudoKind,
+                       size_t &ShownFunctions, raw_fd_ostream &OS) {
+  if (!ShownFunctions)
+    OS << "Counters:\n";
+  ++ShownFunctions;
----------------
minglotus-6 wrote:

It's currently an input and output parameter. I'm not a big fan (in terms of readability, etc) of returning an updated copy of const input parameter and assigning it to the same variable, compared with the current way of using input & output parameter.

https://github.com/llvm/llvm-project/pull/71328


More information about the llvm-commits mailing list