[llvm] r262976 - FunctionIndex is not optional for renameModuleForThinLTO(), make it a reference (NFC)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 8 17:37:15 PST 2016


Author: mehdi_amini
Date: Tue Mar  8 19:37:14 2016
New Revision: 262976

URL: http://llvm.org/viewvc/llvm-project?rev=262976&view=rev
Log:
FunctionIndex is not optional for renameModuleForThinLTO(), make it a reference (NFC)

From: Mehdi Amini <mehdi.amini at apple.com>

Modified:
    llvm/trunk/include/llvm/Transforms/Utils/FunctionImportUtils.h
    llvm/trunk/lib/Linker/LinkModules.cpp
    llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
    llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp

Modified: llvm/trunk/include/llvm/Transforms/Utils/FunctionImportUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/FunctionImportUtils.h?rev=262976&r1=262975&r2=262976&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/FunctionImportUtils.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/FunctionImportUtils.h Tue Mar  8 19:37:14 2016
@@ -28,7 +28,7 @@ class FunctionImportGlobalProcessing {
   Module &M;
 
   /// Function index passed in for function importing/exporting handling.
-  const FunctionInfoIndex *ImportIndex;
+  const FunctionInfoIndex &ImportIndex;
 
   /// Functions to import from this module, all other functions will be
   /// imported as declarations instead of definitions.
@@ -76,7 +76,7 @@ class FunctionImportGlobalProcessing {
 
 public:
   FunctionImportGlobalProcessing(
-      Module &M, const FunctionInfoIndex *Index,
+      Module &M, const FunctionInfoIndex &Index,
       DenseSet<const GlobalValue *> *FunctionsToImport = nullptr)
       : M(M), ImportIndex(Index), FunctionsToImport(FunctionsToImport) {
     // If we have a FunctionInfoIndex but no function to import,
@@ -84,7 +84,7 @@ public:
     // backend compilation, and we need to see if it has functions that
     // may be exported to another backend compilation.
     if (!FunctionsToImport)
-      HasExportedFunctions = ImportIndex->hasExportedFunctions(M);
+      HasExportedFunctions = ImportIndex.hasExportedFunctions(M);
   }
 
   bool run();
@@ -99,7 +99,7 @@ public:
 
 /// Perform in-place global value handling on the given Module for
 /// exported local functions renamed and promoted for ThinLTO.
-bool renameModuleForThinLTO(Module &M, const FunctionInfoIndex *Index);
+bool renameModuleForThinLTO(Module &M, const FunctionInfoIndex &Index);
 
 } // End llvm namespace
 

Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=262976&r1=262975&r2=262976&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Tue Mar  8 19:37:14 2016
@@ -509,7 +509,7 @@ bool ModuleLinker::run() {
       return true;
 
   if (ImportIndex) {
-    FunctionImportGlobalProcessing ThinLTOProcessing(*SrcM, ImportIndex,
+    FunctionImportGlobalProcessing ThinLTOProcessing(*SrcM, *ImportIndex,
                                                      FunctionsToImport);
     if (ThinLTOProcessing.run())
       return true;

Modified: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp?rev=262976&r1=262975&r2=262976&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp Tue Mar  8 19:37:14 2016
@@ -436,7 +436,7 @@ public:
 
     // First we need to promote to global scope and rename any local values that
     // are potentially exported to other modules.
-    if (renameModuleForThinLTO(M, Index)) {
+    if (renameModuleForThinLTO(M, *Index)) {
       errs() << "Error renaming module\n";
       return false;
     }

Modified: llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp?rev=262976&r1=262975&r2=262976&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/FunctionImportUtils.cpp Tue Mar  8 19:37:14 2016
@@ -90,7 +90,7 @@ std::string FunctionImportGlobalProcessi
       (doPromoteLocalToGlobal(SGV) || isPerformingImport()))
     return FunctionInfoIndex::getGlobalNameForLocal(
         SGV->getName(),
-        ImportIndex->getModuleId(SGV->getParent()->getModuleIdentifier()));
+        ImportIndex.getModuleId(SGV->getParent()->getModuleIdentifier()));
   return SGV->getName();
 }
 
@@ -231,7 +231,7 @@ bool FunctionImportGlobalProcessing::run
   return false;
 }
 
-bool llvm::renameModuleForThinLTO(Module &M, const FunctionInfoIndex *Index) {
+bool llvm::renameModuleForThinLTO(Module &M, const FunctionInfoIndex &Index) {
   FunctionImportGlobalProcessing ThinLTOProcessing(M, Index);
   return ThinLTOProcessing.run();
 }




More information about the llvm-commits mailing list