[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Feb 1 11:11:03 PST 2005



Changes in directory llvm/lib/Analysis/DataStructure:

Printer.cpp updated: 1.74 -> 1.75
---
Log message:

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.


---
Diffs of the changes:  (+9 -3)

 Printer.cpp |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)


Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.74 llvm/lib/Analysis/DataStructure/Printer.cpp:1.75
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.74	Sun Jan 30 17:51:02 2005
+++ llvm/lib/Analysis/DataStructure/Printer.cpp	Tue Feb  1 13:10:48 2005
@@ -274,9 +274,15 @@
         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";
       }






More information about the llvm-commits mailing list