summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/ModuleSummaryIndex.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-04-05 00:40:16 +0000
committerTeresa Johnson <tejohnson@google.com>2016-04-05 00:40:16 +0000
commitfb7c7644965d5d28b5bea1d3061c1703ce925a07 (patch)
tree3d3dd57c0b347be38e936660d52f06b4f74f63cf /llvm/lib/IR/ModuleSummaryIndex.cpp
parent86d8d876401e3e3166c1da794cd256461b76f931 (diff)
downloadbcm5719-llvm-fb7c7644965d5d28b5bea1d3061c1703ce925a07.tar.gz
bcm5719-llvm-fb7c7644965d5d28b5bea1d3061c1703ce925a07.zip
[ThinLTO] Refactor some common code into getGlobalValueInfo method (NFC)
Refactor common code that queries the ModuleSummaryIndex for a value's GlobalValueInfo struct into getGlobalValueInfo helper methods, which will also be used by D18763. llvm-svn: 265370
Diffstat (limited to 'llvm/lib/IR/ModuleSummaryIndex.cpp')
-rw-r--r--llvm/lib/IR/ModuleSummaryIndex.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp
index 5effc65158d..340eccac6bd 100644
--- a/llvm/lib/IR/ModuleSummaryIndex.cpp
+++ b/llvm/lib/IR/ModuleSummaryIndex.cpp
@@ -68,3 +68,15 @@ void ModuleSummaryIndex::removeEmptySummaryEntries() {
++MI;
}
}
+
+GlobalValueInfo *
+ModuleSummaryIndex::getGlobalValueInfo(uint64_t ValueGUID,
+ bool PerModuleIndex) const {
+ auto InfoList = findGlobalValueInfoList(ValueGUID);
+ assert(InfoList != end() && "GlobalValue not found in index");
+ assert(!PerModuleIndex ||
+ InfoList->second.size() == 1 &&
+ "Expected a single entry per global value in per-module index");
+ auto &Info = InfoList->second[0];
+ return Info.get();
+}
OpenPOWER on IntegriCloud