[llvm] [LTO] Introduce a helper function collectImportStatistics (NFC) (PR #106179)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 08:26:03 PDT 2024


================
@@ -1082,21 +1082,29 @@ numGlobalVarSummaries(const ModuleSummaryIndex &Index,
   return NumGVS;
 }
 
-// Given ImportMap, return the number of global variable summaries and record
-// the number of defined function summaries as output parameter.
-static unsigned
-numGlobalVarSummaries(const ModuleSummaryIndex &Index,
-                      const FunctionImporter::FunctionsToImportTy &ImportMap,
-                      unsigned &DefinedFS) {
+struct ImportStatistics {
   unsigned NumGVS = 0;
-  DefinedFS = 0;
-  for (auto &[GUID, Type] : ImportMap) {
-    if (isGlobalVarSummary(Index, GUID))
-      ++NumGVS;
-    else if (Type == GlobalValueSummary::Definition)
-      ++DefinedFS;
+  unsigned DefinedFS = 0;
+  unsigned Count = 0;
+};
+
+// Compute import summary for each source module in ImportList.
----------------
teresajohnson wrote:

nit: s/summary/statistics/

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


More information about the llvm-commits mailing list