[BOLT] Respect shouldPrint in dump-dot-all
authorAmir Ayupov <aaupov@fb.com>
Thu, 30 Jun 2022 00:01:02 +0000 (17:01 -0700)
committerAmir Ayupov <aaupov@fb.com>
Thu, 30 Jun 2022 00:01:17 +0000 (17:01 -0700)
Don't dump dot CFG graph for functions that should not be printed.

Reviewed By: rafauler, maksfb

Differential Revision: https://reviews.llvm.org/D128699

bolt/lib/Core/BinaryFunction.cpp

index d490c4e..46a86d6 100644 (file)
@@ -3110,8 +3110,12 @@ void BinaryFunction::viewGraph() const {
 }
 
 void BinaryFunction::dumpGraphForPass(std::string Annotation) const {
+  if (!opts::shouldPrint(*this))
+    return;
+
   std::string Filename = constructFilename(getPrintName(), Annotation, ".dot");
-  outs() << "BOLT-DEBUG: Dumping CFG to " << Filename << "\n";
+  if (opts::Verbosity >= 1)
+    outs() << "BOLT-INFO: dumping CFG to " << Filename << "\n";
   dumpGraphToFile(Filename);
 }
 
@@ -4373,6 +4377,9 @@ DebugLocationsVector BinaryFunction::translateInputToOutputLocationList(
 }
 
 void BinaryFunction::printLoopInfo(raw_ostream &OS) const {
+  if (!opts::shouldPrint(*this))
+    return;
+
   OS << "Loop Info for Function \"" << *this << "\"";
   if (hasValidProfile())
     OS << " (count: " << getExecutionCount() << ")";