[llvm] 14dfdc0 - [OptBisect] Add an option to disable print of pass message (#101065)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 05:41:54 PDT 2024


Author: Shilei Tian
Date: 2024-07-30T08:41:52-04:00
New Revision: 14dfdc00d96b9c51eae4c802397ac5b15f097401

URL: https://github.com/llvm/llvm-project/commit/14dfdc00d96b9c51eae4c802397ac5b15f097401
DIFF: https://github.com/llvm/llvm-project/commit/14dfdc00d96b9c51eae4c802397ac5b15f097401.diff

LOG: [OptBisect] Add an option to disable print of pass message (#101065)

The print could take a huge amount of time if there are millions of
optimization
passes running. This patch simply adds an option to disable the print.

Added: 
    

Modified: 
    llvm/lib/IR/OptBisect.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/OptBisect.cpp b/llvm/lib/IR/OptBisect.cpp
index 893a5e59c86a6..559b199445366 100644
--- a/llvm/lib/IR/OptBisect.cpp
+++ b/llvm/lib/IR/OptBisect.cpp
@@ -32,6 +32,11 @@ static cl::opt<int> OptBisectLimit("opt-bisect-limit", cl::Hidden,
                                    }),
                                    cl::desc("Maximum optimization to perform"));
 
+static cl::opt<bool> OptBisectVerbose(
+    "opt-bisect-verbose",
+    cl::desc("Show verbose output when opt-bisect-limit is set"), cl::Hidden,
+    cl::init(true), cl::Optional);
+
 static void printPassMessage(const StringRef &Name, int PassNum,
                              StringRef TargetDesc, bool Running) {
   StringRef Status = Running ? "" : "NOT ";
@@ -45,7 +50,8 @@ bool OptBisect::shouldRunPass(const StringRef PassName,
 
   int CurBisectNum = ++LastBisectNum;
   bool ShouldRun = (BisectLimit == -1 || CurBisectNum <= BisectLimit);
-  printPassMessage(PassName, CurBisectNum, IRDescription, ShouldRun);
+  if (OptBisectVerbose)
+    printPassMessage(PassName, CurBisectNum, IRDescription, ShouldRun);
   return ShouldRun;
 }
 


        


More information about the llvm-commits mailing list