Skip to content

[LTO] Introduce new type alias ImportListsTy (NFC) #106420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion llvm/include/llvm/Transforms/IPO/FunctionImport.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ class FunctionImporter {
ImportMapTyImpl ImportMap;
};

// A map from destination modules to lists of imports.
using ImportListsTy = DenseMap<StringRef, ImportMapTy>;

/// The set contains an entry for every global value that the module exports.
/// Depending on the user context, this container is allowed to contain
/// definitions, declarations or a mix of both.
Expand Down Expand Up @@ -211,7 +214,7 @@ void ComputeCrossModuleImport(
const DenseMap<StringRef, GVSummaryMapTy> &ModuleToDefinedGVSummaries,
function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
isPrevailing,
DenseMap<StringRef, FunctionImporter::ImportMapTy> &ImportLists,
FunctionImporter::ImportListsTy &ImportLists,
DenseMap<StringRef, FunctionImporter::ExportSetTy> &ExportLists);

/// PrevailingType enum used as a return type of callback passed
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/LTO/LTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1716,8 +1716,7 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache,
// Synthesize entry counts for functions in the CombinedIndex.
computeSyntheticCounts(ThinLTO.CombinedIndex);

DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists(
ThinLTO.ModuleMap.size());
FunctionImporter::ImportListsTy ImportLists(ThinLTO.ModuleMap.size());
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists(
ThinLTO.ModuleMap.size());
StringMap<std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>> ResolvedODR;
Expand Down
12 changes: 6 additions & 6 deletions llvm/lib/LTO/ThinLTOCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ void ThinLTOCodeGenerator::promote(Module &TheModule, ModuleSummaryIndex &Index,
computePrevailingCopies(Index, PrevailingCopy);

// Generate import/export list
DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists(ModuleCount);
FunctionImporter::ImportListsTy ImportLists(ModuleCount);
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists(ModuleCount);
ComputeCrossModuleImport(Index, ModuleToDefinedGVSummaries,
IsPrevailing(PrevailingCopy), ImportLists,
Expand Down Expand Up @@ -745,7 +745,7 @@ void ThinLTOCodeGenerator::crossModuleImport(Module &TheModule,
computePrevailingCopies(Index, PrevailingCopy);

// Generate import/export list
DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists(ModuleCount);
FunctionImporter::ImportListsTy ImportLists(ModuleCount);
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists(ModuleCount);
ComputeCrossModuleImport(Index, ModuleToDefinedGVSummaries,
IsPrevailing(PrevailingCopy), ImportLists,
Expand Down Expand Up @@ -785,7 +785,7 @@ void ThinLTOCodeGenerator::gatherImportedSummariesForModule(
computePrevailingCopies(Index, PrevailingCopy);

// Generate import/export list
DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists(ModuleCount);
FunctionImporter::ImportListsTy ImportLists(ModuleCount);
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists(ModuleCount);
ComputeCrossModuleImport(Index, ModuleToDefinedGVSummaries,
IsPrevailing(PrevailingCopy), ImportLists,
Expand Down Expand Up @@ -823,7 +823,7 @@ void ThinLTOCodeGenerator::emitImports(Module &TheModule, StringRef OutputName,
computePrevailingCopies(Index, PrevailingCopy);

// Generate import/export list
DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists(ModuleCount);
FunctionImporter::ImportListsTy ImportLists(ModuleCount);
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists(ModuleCount);
ComputeCrossModuleImport(Index, ModuleToDefinedGVSummaries,
IsPrevailing(PrevailingCopy), ImportLists,
Expand Down Expand Up @@ -874,7 +874,7 @@ void ThinLTOCodeGenerator::internalize(Module &TheModule,
computePrevailingCopies(Index, PrevailingCopy);

// Generate import/export list
DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists(ModuleCount);
FunctionImporter::ImportListsTy ImportLists(ModuleCount);
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists(ModuleCount);
ComputeCrossModuleImport(Index, ModuleToDefinedGVSummaries,
IsPrevailing(PrevailingCopy), ImportLists,
Expand Down Expand Up @@ -1074,7 +1074,7 @@ void ThinLTOCodeGenerator::run() {

// Collect the import/export lists for all modules from the call-graph in the
// combined index.
DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists(ModuleCount);
FunctionImporter::ImportListsTy ImportLists(ModuleCount);
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists(ModuleCount);
ComputeCrossModuleImport(*Index, ModuleToDefinedGVSummaries,
IsPrevailing(PrevailingCopy), ImportLists,
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/IPO/FunctionImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ collectImportStatistics(const ModuleSummaryIndex &Index,
#ifndef NDEBUG
static bool checkVariableImport(
const ModuleSummaryIndex &Index,
DenseMap<StringRef, FunctionImporter::ImportMapTy> &ImportLists,
FunctionImporter::ImportListsTy &ImportLists,
DenseMap<StringRef, FunctionImporter::ExportSetTy> &ExportLists) {
DenseSet<GlobalValue::GUID> FlattenedImports;

Expand Down Expand Up @@ -1152,7 +1152,7 @@ void llvm::ComputeCrossModuleImport(
const DenseMap<StringRef, GVSummaryMapTy> &ModuleToDefinedGVSummaries,
function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
isPrevailing,
DenseMap<StringRef, FunctionImporter::ImportMapTy> &ImportLists,
FunctionImporter::ImportListsTy &ImportLists,
DenseMap<StringRef, FunctionImporter::ExportSetTy> &ExportLists) {
auto MIS = ModuleImportsManager::create(isPrevailing, Index, &ExportLists);
// For each module that has function defined, compute the import/export lists.
Expand Down
Loading