-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[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
[LTO] Introduce new type alias ImportListsTy (NFC) #106420
Conversation
The background is as follows. I'm planning to reduce the memory footprint of ThinLTO indexing by changing ImportMapTy, the data structure used for an import list. Once this patch lands, I'm planning to change the type slightly. The new type alias allows us to update the type without touching many places.
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-lto Author: Kazu Hirata (kazutakahirata) ChangesThe background is as follows. I'm planning to reduce the memory Full diff: https://github.com/llvm/llvm-project/pull/106420.diff 4 Files Affected:
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
index b5b969220df85b..c06d96bbe62e22 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
@@ -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.
@@ -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
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index bd031338e8f39b..09dfec03cb0c34 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -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;
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index f74202781a5f4b..9d5a62fe10c8d7 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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,
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 512f771a873aa1..6227b085f13a60 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -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;
@@ -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.
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/3933 Here is the relevant piece of the build log for the reference
|
The background is as follows. I'm planning to reduce the memory
footprint of ThinLTO indexing by changing ImportMapTy, the data
structure used for an import list. Once this patch lands, I'm
planning to change the type slightly. The new type alias allows us to
update the type without touching many places.