Skip to content

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, jdoerfert and nikic 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
@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.

4 participants