[llvm] [OptBisect] Add an option to disable print of pass message (PR #101065)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 13:27:37 PDT 2024
https://github.com/shiltian updated https://github.com/llvm/llvm-project/pull/101065
>From dbdfb5bdea2875c4d273a30e0274b91c7a82119c Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Mon, 29 Jul 2024 14:55:58 -0400
Subject: [PATCH] [OptBisect] Add an option to disable print of pass message
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.
---
llvm/lib/IR/OptBisect.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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