forked from OSchip/llvm-project
Don't count all of the nodes in the SCC once for each function in the SCC.
llvm-svn: 20836
This commit is contained in:
parent
5ecec08ab5
commit
b7ffd50537
|
@ -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)
|
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||||
if (C.hasGraph(*I)) {
|
if (C.hasGraph(*I)) {
|
||||||
DSGraph &Gr = C.getDSGraph((Function&)*I);
|
DSGraph &Gr = C.getDSGraph((Function&)*I);
|
||||||
TotalNumNodes += Gr.getGraphSize();
|
|
||||||
unsigned NumCalls = Gr.shouldPrintAuxCalls() ?
|
unsigned NumCalls = Gr.shouldPrintAuxCalls() ?
|
||||||
Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size();
|
Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size();
|
||||||
|
|
||||||
TotalCallNodes += NumCalls;
|
|
||||||
if (I->getName() == "main" || !OnlyPrintMain) {
|
if (I->getName() == "main" || !OnlyPrintMain) {
|
||||||
Function *SCCFn = Gr.retnodes_begin()->first;
|
Function *SCCFn = Gr.retnodes_begin()->first;
|
||||||
if (&*I == SCCFn)
|
if (&*I == SCCFn) {
|
||||||
|
TotalNumNodes += Gr.getGraphSize();
|
||||||
|
TotalCallNodes += NumCalls;
|
||||||
|
|
||||||
Gr.writeGraphToFile(O, Prefix+I->getName());
|
Gr.writeGraphToFile(O, Prefix+I->getName());
|
||||||
else
|
} else {
|
||||||
|
// Don't double count node/call nodes.
|
||||||
O << "Didn't write '" << Prefix+I->getName()
|
O << "Didn't write '" << Prefix+I->getName()
|
||||||
<< ".dot' - Graph already emitted to '" << Prefix+SCCFn->getName()
|
<< ".dot' - Graph already emitted to '" << Prefix+SCCFn->getName()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
TotalNumNodes += Gr.getGraphSize();
|
||||||
|
TotalCallNodes += NumCalls;
|
||||||
O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... ["
|
O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... ["
|
||||||
<< Gr.getGraphSize() << "+" << NumCalls << "]\n";
|
<< Gr.getGraphSize() << "+" << NumCalls << "]\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue