mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
[ThinLTO] Add option to dump per-module summary dot graph
Summary: I found that there currently isn't a way to invoke exportToDot from the command line for a per-module summary index, and therefore no testing of that case. Add an internal option and use it to test dumping of per module summary indexes. In particular, I am looking at fixing the limitation that causes the aliasee GUID in the per-module summary to be 0, and want to be able to test that change. Reviewers: evgeny777 Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D57206 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352441 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -70,6 +70,11 @@ cl::opt<FunctionSummary::ForceSummaryHotnessType, true> FSEC(
|
||||
"all-non-critical", "All non-critical edges."),
|
||||
clEnumValN(FunctionSummary::FSHT_All, "all", "All edges.")));
|
||||
|
||||
cl::opt<std::string> ModuleSummaryDotFile(
|
||||
"module-summary-dot-file", cl::init(""), cl::Hidden,
|
||||
cl::value_desc("filename"),
|
||||
cl::desc("File to emit dot graph of new summary into."));
|
||||
|
||||
// Walk through the operands of a given User via worklist iteration and populate
|
||||
// the set of GlobalValue references encountered. Invoked either on an
|
||||
// Instruction or a GlobalVariable (which walks its initializer).
|
||||
@@ -625,6 +630,15 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
|
||||
}
|
||||
}
|
||||
|
||||
if (!ModuleSummaryDotFile.empty()) {
|
||||
std::error_code EC;
|
||||
raw_fd_ostream OSDot(ModuleSummaryDotFile, EC, sys::fs::OpenFlags::F_None);
|
||||
if (EC)
|
||||
report_fatal_error(Twine("Failed to open dot file ") +
|
||||
ModuleSummaryDotFile + ": " + EC.message() + "\n");
|
||||
Index.exportToDot(OSDot);
|
||||
}
|
||||
|
||||
return Index;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user