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

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 11:59:11 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Shilei Tian (shiltian)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/101065.diff


1 Files Affected:

- (modified) llvm/lib/IR/OptBisect.cpp (+7-1) 


``````````diff
diff --git a/llvm/lib/IR/OptBisect.cpp b/llvm/lib/IR/OptBisect.cpp
index 893a5e59c86a6..1a5fc1411ed42 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> OptBisectPrintPassMessage(
+    "opt-bisect-print-pass-message",
+    cl::desc("Whether print pass message 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 (OptBisectPrintPassMessage)
+    printPassMessage(PassName, CurBisectNum, IRDescription, ShouldRun);
   return ShouldRun;
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/101065


More information about the llvm-commits mailing list