From bd04e8fed6e89edb6a1c7b9da6dfe6b39564d6f6 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 9 Mar 2016 01:37:14 +0000 Subject: [PATCH] FunctionIndex is not optional for renameModuleForThinLTO(), make it a reference (NFC) From: Mehdi Amini llvm-svn: 262976 --- llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h | 8 ++++---- llvm/lib/Linker/LinkModules.cpp | 2 +- llvm/lib/Transforms/IPO/FunctionImport.cpp | 2 +- llvm/lib/Transforms/Utils/FunctionImportUtils.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h b/llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h index de0c2fc..06b9734 100644 --- a/llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h +++ b/llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h @@ -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 *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 diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 6b19d92..e3ad7bb 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -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; diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 89f3f9d..6589f56 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -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; } diff --git a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp index b114ad0..73069b2 100644 --- a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp +++ b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp @@ -90,7 +90,7 @@ std::string FunctionImportGlobalProcessing::getName(const GlobalValue *SGV) { (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(); } -- 2.7.4