[llvm] [bolt] add support for bisecting bolt opt passes (PR #88758)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 15 10:01:07 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff da5a86b53e7d6e7ff7407b16c2c869894493ee99 52ebaf4b313039fbb11a614cff3cf0cc99296264 -- bolt/include/bolt/Core/BoltBisect.h bolt/lib/Core/BoltBisect.cpp bolt/include/bolt/Core/BinaryContext.h bolt/include/bolt/Passes/BinaryPasses.h bolt/lib/Passes/BinaryPasses.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h
index 3b745ab24f..13252ba4db 100644
--- a/bolt/include/bolt/Core/BinaryContext.h
+++ b/bolt/include/bolt/Core/BinaryContext.h
@@ -36,8 +36,8 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/TargetRegistry.h"
-#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/RWMutex.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
@@ -267,10 +267,7 @@ class BinaryContext {
void deregisterSectionName(const BinarySection &Section);
public:
-
- BoltBisect &getBoltBisect() const {
- return *BoltBisector;
- }
+ BoltBisect &getBoltBisect() const { return *BoltBisector; }
static Expected<std::unique_ptr<BinaryContext>>
createBinaryContext(Triple TheTriple, StringRef InputFileName,
SubtargetFeatures *Features, bool IsPIC,
diff --git a/bolt/include/bolt/Core/BoltBisect.h b/bolt/include/bolt/Core/BoltBisect.h
index f989e65ddc..f06faf89c0 100644
--- a/bolt/include/bolt/Core/BoltBisect.h
+++ b/bolt/include/bolt/Core/BoltBisect.h
@@ -1,4 +1,5 @@
-//===- llvm/IR/BoltBisect.h - LLVM Bisect support ----------------*- C++ -*-===//
+//===- llvm/IR/BoltBisect.h - LLVM Bisect support ----------------*- C++
+//-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -23,16 +24,13 @@ class BoltPassGate {
public:
virtual ~BoltPassGate() = default;
- virtual bool shouldRunPass(const StringRef PassName) {
- return true;
- }
+ virtual bool shouldRunPass(const StringRef PassName) { return true; }
virtual bool isEnabled() const { return false; }
};
class BoltBisect : public BoltPassGate {
public:
-
BoltBisect() = default;
virtual ~BoltBisect() = default;
diff --git a/bolt/lib/Core/BoltBisect.cpp b/bolt/lib/Core/BoltBisect.cpp
index 11d5556acd..c85d53864b 100644
--- a/bolt/lib/Core/BoltBisect.cpp
+++ b/bolt/lib/Core/BoltBisect.cpp
@@ -25,18 +25,16 @@ static BoltBisect &getBoltBisector() {
return BoltBisector;
}
-static cl::opt<int> BoltBisectLimit("opt-bisect-limit", cl::Hidden,
- cl::init(BoltBisect::Disabled), cl::Optional,
- cl::cb<void, int>([](int Limit) {
- getBoltBisector().setLimit(Limit);
- }),
- cl::desc("Maximum optimization to perform"));
-
-static void printPassMessage(const StringRef &Name, int PassNum,
- bool Running) {
+static cl::opt<int> BoltBisectLimit(
+ "opt-bisect-limit", cl::Hidden, cl::init(BoltBisect::Disabled),
+ cl::Optional,
+ cl::cb<void, int>([](int Limit) { getBoltBisector().setLimit(Limit); }),
+ cl::desc("Maximum optimization to perform"));
+
+static void printPassMessage(const StringRef &Name, int PassNum, bool Running) {
StringRef Status = Running ? "" : "NOT ";
- errs() << "BISECT: " << Status << "running pass "
- << "(" << PassNum << ") " << Name << " on " << "\n";
+ errs() << "BISECT: " << Status << "running pass " << "(" << PassNum << ") "
+ << Name << " on " << "\n";
}
bool BoltBisect::shouldRunPass(const StringRef PassName) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/88758
More information about the llvm-commits
mailing list