Skip to content

[OptBisect] Add an option to disable print of pass message #101065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

shiltian
Copy link
Contributor

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.

@shiltian shiltian marked this pull request as ready for review July 29, 2024 18:58
Copy link
Contributor Author

shiltian commented Jul 29, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @shiltian and the rest of your teammates on Graphite Graphite

@llvmbot
Copy link
Member

llvmbot commented Jul 29, 2024

@llvm/pr-subscribers-llvm-ir

Author: Shilei Tian (shiltian)

Changes

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 --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;
 }
 

@shiltian shiltian requested review from arsenm, nikic and jdoerfert July 29, 2024 18:59
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.
@shiltian shiltian force-pushed the users/shiltian/disable-opt-bisect-print branch from abcbb8e to dbdfb5b Compare July 29, 2024 20:27
Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically verbose flag would be false by default but ok

@shiltian shiltian merged commit 14dfdc0 into main Jul 30, 2024
7 checks passed
@shiltian shiltian deleted the users/shiltian/disable-opt-bisect-print branch July 30, 2024 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants