Simplify code
authorChris Lattner <sabre@nondot.org>
Fri, 31 Oct 2003 00:20:09 +0000 (00:20 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 31 Oct 2003 00:20:09 +0000 (00:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9625 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-prof/llvm-prof.cpp

index e9f6d991462c05b5345ac506b494be52363454d6..80eb36bd63d80df72def9bf2ea806bbde588e796 100644 (file)
@@ -174,15 +174,15 @@ int main(int argc, char **argv) {
     std::cout << "\n===" << std::string(73, '-') << "===\n";
     std::cout << "Annotated LLVM code for the module:\n\n";
     
-    if (FunctionsToPrint.empty())
-      for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
-        FunctionsToPrint.insert(I);
-    
     ProfileAnnotator PA(FuncFreqs, BlockFreqs);
 
-    for (std::set<Function*>::iterator I = FunctionsToPrint.begin(),
-           E = FunctionsToPrint.end(); I != E; ++I)
-      (*I)->print(std::cout, &PA);
+    if (FunctionsToPrint.empty())
+      M->print(std::cout, &PA);
+    else
+      // Print just a subset of the functions...
+      for (std::set<Function*>::iterator I = FunctionsToPrint.begin(),
+             E = FunctionsToPrint.end(); I != E; ++I)
+        (*I)->print(std::cout, &PA);
   }
 
   return 0;