diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-03-20 11:40:34 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-05-14 11:43:05 +0000 |
| commit | 349cc55c9796c4596a5b9904cd3281af295f878f (patch) | |
| tree | 410c5a785075730a35f1272ca6a7adf72222ad03 /contrib/llvm-project/llvm/lib/IR/OptBisect.cpp | |
| parent | cb2ae6163174b90e999326ecec3699ee093a5d43 (diff) | |
| parent | c0981da47d5696fe36474fcf86b4ce03ae3ff818 (diff) | |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/IR/OptBisect.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/IR/OptBisect.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/contrib/llvm-project/llvm/lib/IR/OptBisect.cpp b/contrib/llvm-project/llvm/lib/IR/OptBisect.cpp index 2cf2298e0005..55c0dbad5aab 100644 --- a/contrib/llvm-project/llvm/lib/IR/OptBisect.cpp +++ b/contrib/llvm-project/llvm/lib/IR/OptBisect.cpp @@ -22,14 +22,12 @@ using namespace llvm; static cl::opt<int> OptBisectLimit("opt-bisect-limit", cl::Hidden, - cl::init(std::numeric_limits<int>::max()), - cl::Optional, + cl::init(OptBisect::Disabled), cl::Optional, + cl::cb<void, int>([](int Limit) { + llvm::OptBisector->setLimit(Limit); + }), cl::desc("Maximum optimization to perform")); -OptBisect::OptBisect() : OptPassGate() { - BisectEnabled = OptBisectLimit != std::numeric_limits<int>::max(); -} - static void printPassMessage(const StringRef &Name, int PassNum, StringRef TargetDesc, bool Running) { StringRef Status = Running ? "" : "NOT "; @@ -38,19 +36,21 @@ static void printPassMessage(const StringRef &Name, int PassNum, } bool OptBisect::shouldRunPass(const Pass *P, StringRef IRDescription) { - assert(BisectEnabled); + assert(isEnabled()); return checkPass(P->getPassName(), IRDescription); } bool OptBisect::checkPass(const StringRef PassName, const StringRef TargetDesc) { - assert(BisectEnabled); + assert(isEnabled()); int CurBisectNum = ++LastBisectNum; - bool ShouldRun = (OptBisectLimit == -1 || CurBisectNum <= OptBisectLimit); + bool ShouldRun = (BisectLimit == -1 || CurBisectNum <= BisectLimit); printPassMessage(PassName, CurBisectNum, TargetDesc, ShouldRun); return ShouldRun; } +const int OptBisect::Disabled; + ManagedStatic<OptBisect> llvm::OptBisector; |
