aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ModuleSummaryIndex.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-04-12 21:13:11 +0000
committerTeresa Johnson <tejohnson@google.com>2016-04-12 21:13:11 +0000
commitc86af3345c9e3d3814c73df644d58c11eba38922 (patch)
treed3b41569e434252bb47a34fed9b89adcf699b843 /llvm/lib/IR/ModuleSummaryIndex.cpp
parent1bb32ac4806f782380099bdb1caa382253f18b1a (diff)
downloadllvm-c86af3345c9e3d3814c73df644d58c11eba38922.zip
llvm-c86af3345c9e3d3814c73df644d58c11eba38922.tar.gz
llvm-c86af3345c9e3d3814c73df644d58c11eba38922.tar.bz2
[ThinLTO] Only compute imports for current module in FunctionImport pass
Summary: The function import pass was computing all the imports for all the modules in the index, and only using the imports for the current module. Change this to instead compute only for the given module. This means that the exports list can't be populated, but they weren't being used anyway. Longer term, the linker can collect all the imports and export lists and serialize them out for consumption by the distributed backend processes which use this pass. Reviewers: joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D18945 llvm-svn: 266125
Diffstat (limited to 'llvm/lib/IR/ModuleSummaryIndex.cpp')
-rw-r--r--llvm/lib/IR/ModuleSummaryIndex.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp
index 32415cf..aa34532 100644
--- a/llvm/lib/IR/ModuleSummaryIndex.cpp
+++ b/llvm/lib/IR/ModuleSummaryIndex.cpp
@@ -69,6 +69,26 @@ void ModuleSummaryIndex::removeEmptySummaryEntries() {
}
}
+// Collect for the given module the list of function it defines
+// (GUID -> Summary).
+void ModuleSummaryIndex::collectDefinedFunctionsForModule(
+ StringRef ModulePath,
+ std::map<GlobalValue::GUID, FunctionSummary *> &FunctionInfoMap) const {
+ for (auto &GlobalList : *this) {
+ auto GUID = GlobalList.first;
+ for (auto &GlobInfo : GlobalList.second) {
+ auto *Summary = dyn_cast_or_null<FunctionSummary>(GlobInfo->summary());
+ if (!Summary)
+ // Ignore global variable, focus on functions
+ continue;
+ // Ignore summaries from other modules.
+ if (Summary->modulePath() != ModulePath)
+ continue;
+ FunctionInfoMap[GUID] = Summary;
+ }
+ }
+}
+
GlobalValueInfo *
ModuleSummaryIndex::getGlobalValueInfo(uint64_t ValueGUID,
bool PerModuleIndex) const {