Skip to content
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

[bolt] add support for bisecting bolt opt passes #88758

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yubingex007-a11y
Copy link
Contributor

No description provided.

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
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
View the diff from clang-format here.
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) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants