summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-02-10 18:57:54 +0000
committerTeresa Johnson <tejohnson@google.com>2016-02-10 18:57:54 +0000
commit0919a84071e55190643eb6e833a51755692b0d29 (patch)
treedefa683bb416a4a6ee5cb54564e29d96d99dd143 /llvm/lib/IR
parentad7b6f5aeaaf9c8fbaad65f1e3a9e21ddb76d048 (diff)
downloadbcm5719-llvm-0919a84071e55190643eb6e833a51755692b0d29.tar.gz
bcm5719-llvm-0919a84071e55190643eb6e833a51755692b0d29.zip
[ThinLTO] Use MD5 hash in function index.
Summary: This patch uses the lower 64-bits of the MD5 hash of a function name as a GUID in the function index, instead of storing function names. Any local functions are first given a global name by prepending the original source file name. This is the same naming scheme and GUID used by PGO in the indexed profile format. This change has a couple of benefits. The primary benefit is size reduction in the combined index file, for example 483.xalancbmk's combined index file was reduced by around 70%. It should also result in memory savings for the index file in memory, as the in-memory map is also indexed by the hash instead of the string. Second, this enables integration with indirect call promotion, since the indirect call profile targets are recorded using the same global naming convention and hash. This will enable the function importer to easily locate function summaries for indirect call profile targets to enable their import and subsequent promotion. The original source file name is recorded in the bitcode in a new module-level record for use in the ThinLTO backend pipeline. Reviewers: davidxl, joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D17028 llvm-svn: 260408
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/FunctionInfo.cpp17
-rw-r--r--llvm/lib/IR/Module.cpp2
2 files changed, 4 insertions, 15 deletions
diff --git a/llvm/lib/IR/FunctionInfo.cpp b/llvm/lib/IR/FunctionInfo.cpp
index e5f3dbbdb74..246023907f9 100644
--- a/llvm/lib/IR/FunctionInfo.cpp
+++ b/llvm/lib/IR/FunctionInfo.cpp
@@ -23,7 +23,7 @@ void FunctionInfoIndex::mergeFrom(std::unique_ptr<FunctionInfoIndex> Other,
StringRef ModPath;
for (auto &OtherFuncInfoLists : *Other) {
- std::string FuncName = OtherFuncInfoLists.getKey();
+ uint64_t FuncGUID = OtherFuncInfoLists.first;
FunctionInfoList &List = OtherFuncInfoLists.second;
// Assert that the func info list only has one entry, since we shouldn't
@@ -49,20 +49,9 @@ void FunctionInfoIndex::mergeFrom(std::unique_ptr<FunctionInfoIndex> Other,
// string reference owned by the combined index.
Info->functionSummary()->setModulePath(ModPath);
- // If it is a local function, rename it.
- if (GlobalValue::isLocalLinkage(
- Info->functionSummary()->getFunctionLinkage())) {
- // Any local functions are virtually renamed when being added to the
- // combined index map, to disambiguate from other functions with
- // the same name. The symbol table created for the combined index
- // file should contain the renamed symbols.
- FuncName =
- FunctionInfoIndex::getGlobalNameForLocal(FuncName, NextModuleId);
- }
-
// Add new function info to existing list. There may be duplicates when
// combining FunctionMap entries, due to COMDAT functions. Any local
- // functions were virtually renamed above.
- addFunctionInfo(FuncName, std::move(Info));
+ // functions were given unique global IDs.
+ addFunctionInfo(FuncGUID, std::move(Info));
}
}
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index ac578d6dba0..fc3f9d073fc 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -47,7 +47,7 @@ template class llvm::SymbolTableListTraits<GlobalAlias>;
//
Module::Module(StringRef MID, LLVMContext &C)
- : Context(C), Materializer(), ModuleID(MID), DL("") {
+ : Context(C), Materializer(), ModuleID(MID), SourceFileName(MID), DL("") {
ValSymTab = new ValueSymbolTable();
NamedMDSymTab = new StringMap<NamedMDNode *>();
Context.addModule(this);
OpenPOWER on IntegriCloud