summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-25 20:37:32 +0000
committerChris Lattner <sabre@nondot.org>2005-03-25 20:37:32 +0000
commit0423e031d63b643742ea6874e10ab09b5c932f34 (patch)
tree93b244a18917b7cd283f8ba44f62f0f0d9184d37 /lib/Analysis
parent33b4276053b42ab24adeac6a448079973294a571 (diff)
Don't count all of the nodes in the SCC once for each function in the SCC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20836 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/DataStructure/Printer.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp
index e991bc51cc8..d24045b7653 100644
--- a/lib/Analysis/DataStructure/Printer.cpp
+++ b/lib/Analysis/DataStructure/Printer.cpp
@@ -283,20 +283,25 @@ static void printCollection(const Collection &C, std::ostream &O,
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
if (C.hasGraph(*I)) {
DSGraph &Gr = C.getDSGraph((Function&)*I);
- TotalNumNodes += Gr.getGraphSize();
unsigned NumCalls = Gr.shouldPrintAuxCalls() ?
Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size();
- TotalCallNodes += NumCalls;
if (I->getName() == "main" || !OnlyPrintMain) {
Function *SCCFn = Gr.retnodes_begin()->first;
- if (&*I == SCCFn)
+ if (&*I == SCCFn) {
+ TotalNumNodes += Gr.getGraphSize();
+ TotalCallNodes += NumCalls;
+
Gr.writeGraphToFile(O, Prefix+I->getName());
- else
+ } else {
+ // 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";
}