From 24b3d258bbeadd4fe50c8664c0638e511e8925c0 Mon Sep 17 00:00:00 2001 From: Eugene Leviant Date: Tue, 26 Feb 2019 07:38:21 +0000 Subject: [ThinLTO] Use defined node and edge order when dumping DOT file Differential revision: https://reviews.llvm.org/D58631 llvm-svn: 354850 --- llvm/lib/IR/ModuleSummaryIndex.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'llvm/lib/IR/ModuleSummaryIndex.cpp') diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp index 5279cd6..6ae6285 100644 --- a/llvm/lib/IR/ModuleSummaryIndex.cpp +++ b/llvm/lib/IR/ModuleSummaryIndex.cpp @@ -65,17 +65,6 @@ void ModuleSummaryIndex::collectDefinedFunctionsForModule( } } -// Collect for each module the list of function it defines (GUID -> Summary). -void ModuleSummaryIndex::collectDefinedGVSummariesPerModule( - StringMap &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 CrossModuleEdges; DenseMap> NodeMap; - StringMap ModuleToDefinedGVS; + using GVSOrderedMapTy = std::map; + std::map ModuleToDefinedGVS; collectDefinedGVSummariesPerModule(ModuleToDefinedGVS); // Get node identifier in form MXXX_. 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; -- cgit v1.1