[llvm] a479dd1 - [nfc][thinlto] Mark some functions explicitly as "Test"

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 16:31:00 PDT 2023


Author: Mircea Trofin
Date: 2023-08-31T16:30:18-07:00
New Revision: a479dd124254de8086122244868784448fe0bd66

URL: https://github.com/llvm/llvm-project/commit/a479dd124254de8086122244868784448fe0bd66
DIFF: https://github.com/llvm/llvm-project/commit/a479dd124254de8086122244868784448fe0bd66.diff

LOG: [nfc][thinlto] Mark some functions explicitly as "Test"

Also removed them from the header. They are there for test-only. This
simplifies further refactoring (as well as code comprehension)

Differential Revision: https://reviews.llvm.org/D159308

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/IPO/FunctionImport.h
    llvm/lib/Transforms/IPO/FunctionImport.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
index 559418db05933e..f251087923547b 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
@@ -163,29 +163,6 @@ void ComputeCrossModuleImport(
     DenseMap<StringRef, FunctionImporter::ImportMapTy> &ImportLists,
     DenseMap<StringRef, FunctionImporter::ExportSetTy> &ExportLists);
 
-/// Compute all the imports for the given module using the Index.
-///
-/// \p isPrevailing is a callback that will be called with a global value's GUID
-/// and summary and should return whether the module corresponding to the
-/// summary contains the linker-prevailing copy of that value.
-///
-/// \p ImportList will be populated with a map that can be passed to
-/// FunctionImporter::importFunctions() above (see description there).
-void ComputeCrossModuleImportForModule(
-    StringRef ModulePath,
-    function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
-        isPrevailing,
-    const ModuleSummaryIndex &Index, FunctionImporter::ImportMapTy &ImportList);
-
-/// Mark all external summaries in \p Index for import into the given module.
-/// Used for distributed builds using a distributed index.
-///
-/// \p ImportList will be populated with a map that can be passed to
-/// FunctionImporter::importFunctions() above (see description there).
-void ComputeCrossModuleImportForModuleFromIndex(
-    StringRef ModulePath, const ModuleSummaryIndex &Index,
-    FunctionImporter::ImportMapTy &ImportList);
-
 /// PrevailingType enum used as a return type of callback passed
 /// to computeDeadSymbolsAndUpdateIndirectCalls. Yes and No values used when
 /// status explicitly set by symbols resolution, otherwise status is Unknown.

diff  --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 990a8a9cd433d7..6123285622ab5f 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -818,8 +818,15 @@ static void dumpImportListForModule(const ModuleSummaryIndex &Index,
 }
 #endif
 
-/// Compute all the imports for the given module in the Index.
-void llvm::ComputeCrossModuleImportForModule(
+/// Compute all the imports for the given module using the Index.
+///
+/// \p isPrevailing is a callback that will be called with a global value's GUID
+/// and summary and should return whether the module corresponding to the
+/// summary contains the linker-prevailing copy of that value.
+///
+/// \p ImportList will be populated with a map that can be passed to
+/// FunctionImporter::importFunctions() above (see description there).
+static void ComputeCrossModuleImportForModuleForTest(
     StringRef ModulePath,
     function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
         isPrevailing,
@@ -840,9 +847,12 @@ void llvm::ComputeCrossModuleImportForModule(
 #endif
 }
 
-// Mark all external summaries in Index for import into the given module.
-// Used for distributed builds using a distributed index.
-void llvm::ComputeCrossModuleImportForModuleFromIndex(
+/// Mark all external summaries in \p Index for import into the given module.
+/// Used for testing the case of distributed builds using a distributed index.
+///
+/// \p ImportList will be populated with a map that can be passed to
+/// FunctionImporter::importFunctions() above (see description there).
+static void ComputeCrossModuleImportForModuleFromIndexForTest(
     StringRef ModulePath, const ModuleSummaryIndex &Index,
     FunctionImporter::ImportMapTy &ImportList) {
   for (const auto &GlobalList : Index) {
@@ -1459,7 +1469,7 @@ Expected<bool> FunctionImporter::importFunctions(
   return ImportedCount;
 }
 
-static bool doImportingForModule(
+static bool doImportingForModuleForTest(
     Module &M, function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
                    isPrevailing) {
   if (SummaryFile.empty())
@@ -1479,11 +1489,11 @@ static bool doImportingForModule(
   // when testing distributed backend handling via the opt tool, when
   // we have distributed indexes containing exactly the summaries to import.
   if (ImportAllIndex)
-    ComputeCrossModuleImportForModuleFromIndex(M.getModuleIdentifier(), *Index,
-                                               ImportList);
+    ComputeCrossModuleImportForModuleFromIndexForTest(M.getModuleIdentifier(),
+                                                      *Index, ImportList);
   else
-    ComputeCrossModuleImportForModule(M.getModuleIdentifier(), isPrevailing,
-                                      *Index, ImportList);
+    ComputeCrossModuleImportForModuleForTest(M.getModuleIdentifier(),
+                                             isPrevailing, *Index, ImportList);
 
   // Conservatively mark all internal values as promoted. This interface is
   // only used when doing importing via the function importing pass. The pass
@@ -1531,7 +1541,7 @@ PreservedAnalyses FunctionImportPass::run(Module &M,
   auto isPrevailing = [](GlobalValue::GUID, const GlobalValueSummary *) {
     return true;
   };
-  if (!doImportingForModule(M, isPrevailing))
+  if (!doImportingForModuleForTest(M, isPrevailing))
     return PreservedAnalyses::all();
 
   return PreservedAnalyses::none();


        


More information about the llvm-commits mailing list