summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionImport.cpp39
-rw-r--r--llvm/lib/Transforms/IPO/PassManagerBuilder.cpp14
-rw-r--r--llvm/lib/Transforms/Utils/FunctionImportUtils.cpp8
3 files changed, 31 insertions, 30 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 8aa97535170..90b36aab363 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -20,7 +20,7 @@
#include "llvm/IR/Module.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Linker/Linker.h"
-#include "llvm/Object/FunctionIndexObjectFile.h"
+#include "llvm/Object/ModuleSummaryIndexObjectFile.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/SourceMgr.h"
@@ -111,7 +111,7 @@ Module &ModuleLazyLoaderCache::operator()(StringRef Identifier) {
/// calls not already in the \p VisitedFunctions map. If any are
/// found they are added to the \p Worklist for importing.
static void findExternalCalls(
- const Module &DestModule, Function &F, const FunctionInfoIndex &Index,
+ const Module &DestModule, Function &F, const ModuleSummaryIndex &Index,
VisitedFunctionTrackerTy &VisitedFunctions, unsigned Threshold,
SmallVectorImpl<std::pair<StringRef, unsigned>> &Worklist) {
// We need to suffix internal function calls imported from other modules,
@@ -141,7 +141,7 @@ static void findExternalCalls(
if (CalledFunction->hasInternalLinkage()) {
ImportedName = Renamed;
}
- // Compute the global identifier used in the function index.
+ // Compute the global identifier used in the summary index.
auto CalledFunctionGlobalID = Function::getGlobalIdentifier(
CalledFunction->getName(), CalledFunction->getLinkage(),
CalledFunction->getParent()->getSourceFileName());
@@ -192,9 +192,9 @@ static void
GetImportList(Module &DestModule,
SmallVectorImpl<std::pair<StringRef, unsigned>> &Worklist,
VisitedFunctionTrackerTy &VisitedFunctions,
- std::map<StringRef, DenseSet<const GlobalValue *>> &
- ModuleToFunctionsToImportMap,
- const FunctionInfoIndex &Index,
+ std::map<StringRef, DenseSet<const GlobalValue *>>
+ &ModuleToFunctionsToImportMap,
+ const ModuleSummaryIndex &Index,
ModuleLazyLoaderCache &ModuleLoaderCache) {
while (!Worklist.empty()) {
StringRef CalledFunctionName;
@@ -374,11 +374,11 @@ static void diagnosticHandler(const DiagnosticInfo &DI) {
OS << '\n';
}
-/// Parse the function index out of an IR file and return the function
+/// Parse the summary index out of an IR file and return the summary
/// index object if found, or nullptr if not.
-static std::unique_ptr<FunctionInfoIndex>
-getFunctionIndexForFile(StringRef Path, std::string &Error,
- DiagnosticHandlerFunction DiagnosticHandler) {
+static std::unique_ptr<ModuleSummaryIndex>
+getModuleSummaryIndexForFile(StringRef Path, std::string &Error,
+ DiagnosticHandlerFunction DiagnosticHandler) {
std::unique_ptr<MemoryBuffer> Buffer;
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
MemoryBuffer::getFile(Path);
@@ -387,9 +387,9 @@ getFunctionIndexForFile(StringRef Path, std::string &Error,
return nullptr;
}
Buffer = std::move(BufferOrErr.get());
- ErrorOr<std::unique_ptr<object::FunctionIndexObjectFile>> ObjOrErr =
- object::FunctionIndexObjectFile::create(Buffer->getMemBufferRef(),
- DiagnosticHandler);
+ ErrorOr<std::unique_ptr<object::ModuleSummaryIndexObjectFile>> ObjOrErr =
+ object::ModuleSummaryIndexObjectFile::create(Buffer->getMemBufferRef(),
+ DiagnosticHandler);
if (std::error_code EC = ObjOrErr.getError()) {
Error = EC.message();
return nullptr;
@@ -400,9 +400,9 @@ getFunctionIndexForFile(StringRef Path, std::string &Error,
namespace {
/// Pass that performs cross-module function import provided a summary file.
class FunctionImportPass : public ModulePass {
- /// Optional function summary index to use for importing, otherwise
+ /// Optional module summary index to use for importing, otherwise
/// the summary-file option must be specified.
- const FunctionInfoIndex *Index;
+ const ModuleSummaryIndex *Index;
public:
/// Pass identification, replacement for typeid
@@ -413,19 +413,20 @@ public:
return "Function Importing";
}
- explicit FunctionImportPass(const FunctionInfoIndex *Index = nullptr)
+ explicit FunctionImportPass(const ModuleSummaryIndex *Index = nullptr)
: ModulePass(ID), Index(Index) {}
bool runOnModule(Module &M) override {
if (SummaryFile.empty() && !Index)
report_fatal_error("error: -function-import requires -summary-file or "
"file from frontend\n");
- std::unique_ptr<FunctionInfoIndex> IndexPtr;
+ std::unique_ptr<ModuleSummaryIndex> IndexPtr;
if (!SummaryFile.empty()) {
if (Index)
report_fatal_error("error: -summary-file and index from frontend\n");
std::string Error;
- IndexPtr = getFunctionIndexForFile(SummaryFile, Error, diagnosticHandler);
+ IndexPtr =
+ getModuleSummaryIndexForFile(SummaryFile, Error, diagnosticHandler);
if (!IndexPtr) {
errs() << "Error loading file '" << SummaryFile << "': " << Error
<< "\n";
@@ -458,7 +459,7 @@ INITIALIZE_PASS_END(FunctionImportPass, "function-import",
"Summary Based Function Import", false, false)
namespace llvm {
-Pass *createFunctionImportPass(const FunctionInfoIndex *Index = nullptr) {
+Pass *createFunctionImportPass(const ModuleSummaryIndex *Index = nullptr) {
return new FunctionImportPass(Index);
}
}
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index 3bc9cd51413..a5399e5760e 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -23,8 +23,8 @@
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
#include "llvm/IR/DataLayout.h"
-#include "llvm/IR/FunctionInfo.h"
#include "llvm/IR/LegacyPassManager.h"
+#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
@@ -33,10 +33,10 @@
#include "llvm/Transforms/IPO/ForceFunctionAttrs.h"
#include "llvm/Transforms/IPO/FunctionAttrs.h"
#include "llvm/Transforms/IPO/InferFunctionAttrs.h"
+#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Scalar/GVN.h"
#include "llvm/Transforms/Vectorize.h"
-#include "llvm/Transforms/Instrumentation.h"
using namespace llvm;
@@ -127,7 +127,7 @@ PassManagerBuilder::PassManagerBuilder() {
SizeLevel = 0;
LibraryInfo = nullptr;
Inliner = nullptr;
- FunctionIndex = nullptr;
+ ModuleSummary = nullptr;
DisableUnitAtATime = false;
DisableUnrollLoops = false;
BBVectorize = RunBBVectorization;
@@ -572,8 +572,8 @@ void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) {
// Provide AliasAnalysis services for optimizations.
addInitialAliasAnalysisPasses(PM);
- if (FunctionIndex)
- PM.add(createFunctionImportPass(FunctionIndex));
+ if (ModuleSummary)
+ PM.add(createFunctionImportPass(ModuleSummary));
// Allow forcing function attributes as a debugging and tuning aid.
PM.add(createForceFunctionAttrsLegacyPass());
@@ -724,8 +724,8 @@ void PassManagerBuilder::populateThinLTOPassManager(
if (VerifyInput)
PM.add(createVerifierPass());
- if (FunctionIndex)
- PM.add(createFunctionImportPass(FunctionIndex));
+ if (ModuleSummary)
+ PM.add(createFunctionImportPass(ModuleSummary));
populateModulePassManager(PM);
diff --git a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
index 73069b2c742..eceb0850941 100644
--- a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
+++ b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
@@ -68,7 +68,7 @@ bool FunctionImportGlobalProcessing::doPromoteLocalToGlobal(
// For now we are conservative in determining which variables are not
// address taken by checking the unnamed addr flag. To be more aggressive,
// the address taken information must be checked earlier during parsing
- // of the module and recorded in the function index for use when importing
+ // of the module and recorded in the summary index for use when importing
// from that module.
auto *GVar = dyn_cast<GlobalVariable>(SGV);
if (GVar && GVar->isConstant() && GVar->hasUnnamedAddr())
@@ -76,7 +76,7 @@ bool FunctionImportGlobalProcessing::doPromoteLocalToGlobal(
// Eventually we only need to promote functions in the exporting module that
// are referenced by a potentially exported function (i.e. one that is in the
- // function index).
+ // summary index).
return true;
}
@@ -88,7 +88,7 @@ std::string FunctionImportGlobalProcessing::getName(const GlobalValue *SGV) {
// avoid naming conflicts between locals imported from different modules.
if (SGV->hasLocalLinkage() &&
(doPromoteLocalToGlobal(SGV) || isPerformingImport()))
- return FunctionInfoIndex::getGlobalNameForLocal(
+ return ModuleSummaryIndex::getGlobalNameForLocal(
SGV->getName(),
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 ModuleSummaryIndex &Index) {
FunctionImportGlobalProcessing ThinLTOProcessing(M, Index);
return ThinLTOProcessing.run();
}
OpenPOWER on IntegriCloud