summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-03-11 18:52:24 +0000
committerTeresa Johnson <tejohnson@google.com>2016-03-11 18:52:24 +0000
commit76a1c1d0ba05993f3e57f935698ec0fd09b66c8c (patch)
treee89825099cc401c2546bbfa7e0ac83c2e1d98644 /llvm/tools
parentc134810cfb91716554177992c4bbbf2543545a1a (diff)
downloadbcm5719-llvm-76a1c1d0ba05993f3e57f935698ec0fd09b66c8c.tar.gz
bcm5719-llvm-76a1c1d0ba05993f3e57f935698ec0fd09b66c8c.zip
[ThinLTO] Support for reference graph in per-module and combined summary.
Summary: This patch adds support for including a full reference graph including call graph edges and other GV references in the summary. The reference graph edges can be used to make importing decisions without materializing any source modules, can be used in the plugin to make file staging decisions for distributed build systems, and is expected to have other uses. The call graph edges are recorded in each function summary in the bitcode via a list of <CalleeValueIds, StaticCount> tuples when no PGO data exists, or <CalleeValueId, StaticCount, ProfileCount> pairs when there is PGO, where the ValueId can be mapped to the function GUID via the ValueSymbolTable. In the function index in memory, the call graph edges reference the target via the CalleeGUID instead of the CalleeValueId. The reference graph edges are recorded in each summary record with a list of referenced value IDs, which can be mapped to value GUID via the ValueSymbolTable. Addtionally, a new summary record type is added to record references from global variable initializers. A number of bitcode records and data structures have been renamed to reflect the newly expanded scope of the summary beyond functions. More cleanup will follow. Reviewers: joker.eph, davidxl Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D17212 llvm-svn: 263275
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/gold/gold-plugin.cpp4
-rw-r--r--llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp17
-rw-r--r--llvm/tools/llvm-lto/llvm-lto.cpp4
3 files changed, 15 insertions, 10 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index f9ff66a97bf..fb283ada545 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -635,7 +635,7 @@ getFunctionIndexForFile(claimed_file &F, ld_plugin_input_file &Info) {
// Don't bother trying to build an index if there is no summary information
// in this bitcode file.
- if (!object::FunctionIndexObjectFile::hasFunctionSummaryInMemBuffer(
+ if (!object::FunctionIndexObjectFile::hasGlobalValueSummaryInMemBuffer(
BufferRef, diagnosticHandler))
return std::unique_ptr<FunctionInfoIndex>(nullptr);
@@ -1206,7 +1206,7 @@ static ld_plugin_status allSymbolsReadHook(raw_fd_ostream *ApiFile) {
if (EC)
message(LDPL_FATAL, "Unable to open %s.thinlto.bc for writing: %s",
output_name.data(), EC.message().c_str());
- WriteFunctionSummaryToFile(CombinedIndex, OS);
+ WriteIndexToFile(CombinedIndex, OS);
OS.close();
if (options::thinlto_index_only) {
diff --git a/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
index 1e0209bb79a..7ce6efb0576 100644
--- a/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
+++ b/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
@@ -117,8 +117,8 @@ static const char *GetBlockName(unsigned BlockID,
case bitc::METADATA_KIND_BLOCK_ID: return "METADATA_KIND_BLOCK";
case bitc::METADATA_ATTACHMENT_ID: return "METADATA_ATTACHMENT_BLOCK";
case bitc::USELIST_BLOCK_ID: return "USELIST_BLOCK_ID";
- case bitc::FUNCTION_SUMMARY_BLOCK_ID:
- return "FUNCTION_SUMMARY_BLOCK";
+ case bitc::GLOBALVAL_SUMMARY_BLOCK_ID:
+ return "GLOBALVAL_SUMMARY_BLOCK";
case bitc::MODULE_STRTAB_BLOCK_ID: return "MODULE_STRTAB_BLOCK";
}
}
@@ -280,7 +280,8 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID,
STRINGIFY_CODE(VST_CODE, ENTRY)
STRINGIFY_CODE(VST_CODE, BBENTRY)
STRINGIFY_CODE(VST_CODE, FNENTRY)
- STRINGIFY_CODE(VST_CODE, COMBINED_FNENTRY)
+ STRINGIFY_CODE(VST_CODE, COMBINED_GVDEFENTRY)
+ STRINGIFY_CODE(VST_CODE, COMBINED_ENTRY)
}
case bitc::MODULE_STRTAB_BLOCK_ID:
switch (CodeID) {
@@ -288,12 +289,16 @@ static const char *GetCodeName(unsigned CodeID, unsigned BlockID,
return nullptr;
STRINGIFY_CODE(MST_CODE, ENTRY)
}
- case bitc::FUNCTION_SUMMARY_BLOCK_ID:
+ case bitc::GLOBALVAL_SUMMARY_BLOCK_ID:
switch (CodeID) {
default:
return nullptr;
- STRINGIFY_CODE(FS_CODE, PERMODULE_ENTRY)
- STRINGIFY_CODE(FS_CODE, COMBINED_ENTRY)
+ STRINGIFY_CODE(FS, PERMODULE)
+ STRINGIFY_CODE(FS, PERMODULE_PROFILE)
+ STRINGIFY_CODE(FS, PERMODULE_GLOBALVAR_INIT_REFS)
+ STRINGIFY_CODE(FS, COMBINED)
+ STRINGIFY_CODE(FS, COMBINED_PROFILE)
+ STRINGIFY_CODE(FS, COMBINED_GLOBALVAR_INIT_REFS)
}
case bitc::METADATA_ATTACHMENT_ID:
switch(CodeID) {
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp
index d52db448394..f2419949d4a 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -270,7 +270,7 @@ static void createCombinedFunctionIndex() {
raw_fd_ostream OS(OutputFilename + ".thinlto.bc", EC,
sys::fs::OpenFlags::F_None);
error(EC, "error opening the file '" + OutputFilename + ".thinlto.bc'");
- WriteFunctionSummaryToFile(CombinedIndex, OS);
+ WriteIndexToFile(CombinedIndex, OS);
OS.close();
}
@@ -367,7 +367,7 @@ private:
std::error_code EC;
raw_fd_ostream OS(OutputFilename, EC, sys::fs::OpenFlags::F_None);
error(EC, "error opening the file '" + OutputFilename + "'");
- WriteFunctionSummaryToFile(*CombinedIndex, OS);
+ WriteIndexToFile(*CombinedIndex, OS);
return;
}
OpenPOWER on IntegriCloud