[ThinLTO] Use defined node and edge order when dumping DOT file

Differential revision: https://reviews.llvm.org/D58631


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354850 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eugene Leviant
2019-02-26 07:38:21 +00:00
parent 728bc80a2e
commit 6656fc5a78
3 changed files with 66 additions and 73 deletions
+5 -15
View File
@@ -65,17 +65,6 @@ void ModuleSummaryIndex::collectDefinedFunctionsForModule(
}
}
// Collect for each module the list of function it defines (GUID -> Summary).
void ModuleSummaryIndex::collectDefinedGVSummariesPerModule(
StringMap<GVSummaryMapTy> &ModuleToDefinedGVSummaries) const {
for (auto &GlobalList : *this) {
auto GUID = GlobalList.first;
for (auto &Summary : GlobalList.second.SummaryList) {
ModuleToDefinedGVSummaries[Summary->modulePath()][GUID] = Summary.get();
}
}
}
GlobalValueSummary *
ModuleSummaryIndex::getGlobalValueSummary(uint64_t ValueGUID,
bool PerModuleIndex) const {
@@ -341,7 +330,8 @@ static bool hasReadOnlyFlag(const GlobalValueSummary *S) {
void ModuleSummaryIndex::exportToDot(raw_ostream &OS) const {
std::vector<Edge> CrossModuleEdges;
DenseMap<GlobalValue::GUID, std::vector<uint64_t>> NodeMap;
StringMap<GVSummaryMapTy> ModuleToDefinedGVS;
using GVSOrderedMapTy = std::map<GlobalValue::GUID, GlobalValueSummary *>;
std::map<StringRef, GVSOrderedMapTy> ModuleToDefinedGVS;
collectDefinedGVSummariesPerModule(ModuleToDefinedGVS);
// Get node identifier in form MXXX_<GUID>. The MXXX prefix is required,
@@ -378,12 +368,12 @@ void ModuleSummaryIndex::exportToDot(raw_ostream &OS) const {
OS << "digraph Summary {\n";
for (auto &ModIt : ModuleToDefinedGVS) {
auto ModId = getModuleId(ModIt.first());
OS << " // Module: " << ModIt.first() << "\n";
auto ModId = getModuleId(ModIt.first);
OS << " // Module: " << ModIt.first << "\n";
OS << " subgraph cluster_" << std::to_string(ModId) << " {\n";
OS << " style = filled;\n";
OS << " color = lightgrey;\n";
OS << " label = \"" << sys::path::filename(ModIt.first()) << "\";\n";
OS << " label = \"" << sys::path::filename(ModIt.first) << "\";\n";
OS << " node [style=filled,fillcolor=lightblue];\n";
auto &GVSMap = ModIt.second;