[llvm] [ThinLTO] Use a set rather than a map to track exported ValueInfos. (PR #97360)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 22:55:50 PDT 2024


================
@@ -995,34 +995,36 @@ static bool isGlobalVarSummary(const ModuleSummaryIndex &Index,
   return false;
 }
 
+// Return the number of global summaries and record the number of function
+// summaries as output parameter.
 static unsigned numGlobalVarSummaries(const ModuleSummaryIndex &Index,
                                       FunctionImporter::ExportSetTy &ExportSet,
-                                      unsigned &DefinedGVS,
                                       unsigned &DefinedFS) {
-  DefinedGVS = 0;
+  unsigned NumGVS = 0;
   DefinedFS = 0;
   for (auto &VI : ExportSet) {
-    if (isGlobalVarSummary(Index, VI.getGUID())) {
-      ++DefinedGVS;
-    } else
+    if (isGlobalVarSummary(Index, VI.getGUID()))
+      ++NumGVS;
+    else
       ++DefinedFS;
----------------
teresajohnson wrote:

Can't DefinedFS be deduced from ExportSet.size() - NumGVS?

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


More information about the llvm-commits mailing list