aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-01 19:10:48 +0000
committerChris Lattner <sabre@nondot.org>2005-02-01 19:10:48 +0000
commit1e759999ca2ea2213dfd3d89daedc3d6ceb92f40 (patch)
tree55d57225cba8e69377d39b3e96d6e7101c3c6da5 /lib/Analysis/DataStructure
parentdeb692e756cd3826e4ecc6eaec3397177c8b89ce (diff)
Signficantly speed up printing by not emitting the same file twice with
different names. Large SCC's tend to be big, so this saves a lot of time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure')
-rw-r--r--lib/Analysis/DataStructure/Printer.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp
index eb7319df9c..4d5fa81425 100644
--- a/lib/Analysis/DataStructure/Printer.cpp
+++ b/lib/Analysis/DataStructure/Printer.cpp
@@ -274,9 +274,15 @@ static void printCollection(const Collection &C, std::ostream &O,
Gr.getAuxFunctionCalls().size() : Gr.getFunctionCalls().size();
TotalCallNodes += NumCalls;
- if (I->getName() == "main" || !OnlyPrintMain)
- Gr.writeGraphToFile(O, Prefix+I->getName());
- else {
+ if (I->getName() == "main" || !OnlyPrintMain) {
+ Function *SCCFn = Gr.getReturnNodes().begin()->first;
+ if (&*I == SCCFn)
+ Gr.writeGraphToFile(O, Prefix+I->getName());
+ else
+ O << "Didn't write '" << Prefix+I->getName()
+ << ".dot' - Graph already emitted to '" << Prefix+SCCFn->getName()
+ << "\n";
+ } else {
O << "Skipped Writing '" << Prefix+I->getName() << ".dot'... ["
<< Gr.getGraphSize() << "+" << NumCalls << "]\n";
}