From cf9082589c9bc17aa70d328faea82204726918f1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 25 Mar 2005 20:54:45 +0000 Subject: no really, don't double count these nodes either! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20837 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/Printer.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index d24045b7653..03b298cbadb 100644 --- a/lib/Analysis/DataStructure/Printer.cpp +++ b/lib/Analysis/DataStructure/Printer.cpp @@ -285,34 +285,39 @@ static void printCollection(const Collection &C, std::ostream &O, DSGraph &Gr = C.getDSGraph((Function&)*I); unsigned NumCalls = Gr.shouldPrintAuxCalls() ? Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size(); + bool IsDuplicateGraph = false; if (I->getName() == "main" || !OnlyPrintMain) { Function *SCCFn = Gr.retnodes_begin()->first; if (&*I == SCCFn) { - TotalNumNodes += Gr.getGraphSize(); - TotalCallNodes += NumCalls; - Gr.writeGraphToFile(O, Prefix+I->getName()); } else { - // Don't double count node/call nodes. + IsDuplicateGraph = true; // Don't double count node/call nodes. O << "Didn't write '" << Prefix+I->getName() << ".dot' - Graph already emitted to '" << Prefix+SCCFn->getName() << "\n"; } } else { - TotalNumNodes += Gr.getGraphSize(); - TotalCallNodes += NumCalls; - O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... [" - << Gr.getGraphSize() << "+" << NumCalls << "]\n"; + Function *SCCFn = Gr.retnodes_begin()->first; + if (&*I == SCCFn) { + O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... [" + << Gr.getGraphSize() << "+" << NumCalls << "]\n"; + } else { + IsDuplicateGraph = true; // Don't double count node/call nodes. + } } - unsigned GraphSize = Gr.getGraphSize(); - if (MaxGraphSize < GraphSize) MaxGraphSize = GraphSize; + if (!IsDuplicateGraph) { + unsigned GraphSize = Gr.getGraphSize(); + if (MaxGraphSize < GraphSize) MaxGraphSize = GraphSize; - for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end(); - NI != E; ++NI) - if (NI->isNodeCompletelyFolded()) - ++NumFoldedNodes; + TotalNumNodes += Gr.getGraphSize(); + TotalCallNodes += NumCalls; + for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end(); + NI != E; ++NI) + if (NI->isNodeCompletelyFolded()) + ++NumFoldedNodes; + } } DSGraph &GG = C.getGlobalsGraph(); -- cgit v1.2.3