[PATCH] D30856: Remove opt-bisect support for "cases" in favor of debug counters

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 17:09:14 PST 2017


dberlin created this revision.

Ths "cases" support was not quite finished, is unused, and is really just debug counters.
(well, almost, debug counters are slightly more powerful, in that they can skip things at the start, too).
Note, opt-bisect itself could also be implemented as a wrapper around
debug counters, but not sure it's worth it ATM.

I'll shove it on a todo list if we think it is.


https://reviews.llvm.org/D30856

Files:
  docs/OptBisect.rst
  include/llvm/IR/OptBisect.h
  lib/IR/OptBisect.cpp


Index: lib/IR/OptBisect.cpp
===================================================================
--- lib/IR/OptBisect.cpp
+++ lib/IR/OptBisect.cpp
@@ -39,14 +39,6 @@
          << "(" << PassNum << ") " << Name << " on " << TargetDesc << "\n";
 }
 
-static void printCaseMessage(int CaseNum, StringRef Msg, bool Running) {
-  if (Running)
-    errs() << "BISECT: running case (";
-  else
-    errs() << "BISECT: NOT running case (";
-  errs() << CaseNum << "): " << Msg << "\n";
-}
-
 static std::string getDescription(const Module &M) {
   return "module (" + M.getName().str() + ")";
 }
@@ -108,13 +100,3 @@
   printPassMessage(PassName, CurBisectNum, TargetDesc, ShouldRun);
   return ShouldRun;
 }
-
-bool OptBisect::shouldRunCase(const Twine &Msg) {
-  if (!BisectEnabled)
-    return true;
-  int CurFuelNum = ++LastBisectNum;
-  bool ShouldRun = (OptBisectLimit == -1 || CurFuelNum <= OptBisectLimit);
-  printCaseMessage(CurFuelNum, Msg.str(), ShouldRun);
-  return ShouldRun;
-}
-
Index: include/llvm/IR/OptBisect.h
===================================================================
--- include/llvm/IR/OptBisect.h
+++ include/llvm/IR/OptBisect.h
@@ -51,24 +51,6 @@
   template <class UnitT>
   bool shouldRunPass(const Pass *P, const UnitT &U);
 
-  /// Checks the bisect limit to determine if the optimization described by the
-  /// /p Desc argument should run.
-  ///
-  /// This function will immediate return true if bisection is disabled. If the
-  /// bisect limit is set to -1, the function will print a message with the
-  /// bisect number assigned to the optimization along with the /p Desc
-  /// description and return true.  Otherwise, the function will print a message
-  /// with the bisect number assigned to the optimization and indicating whether
-  /// or not the pass will be run and return true if the bisect limit has not
-  /// yet been exceded or false if it has.
-  ///
-  /// Passes may call this function to provide more fine grained control over
-  /// individual optimizations performed by the pass.  Passes which cannot be
-  /// skipped entirely (such as non-optional code generation passes) may still
-  /// call this function to control whether or not individual optional
-  /// transformations are performed.
-  bool shouldRunCase(const Twine &Desc);
-
 private:
   bool checkPass(const StringRef PassName, const StringRef TargetDesc);
 
Index: docs/OptBisect.rst
===================================================================
--- docs/OptBisect.rst
+++ docs/OptBisect.rst
@@ -189,12 +189,5 @@
 
 Once the pass in which an incorrect transformation is performed has been
 determined, it may be useful to perform further analysis in order to determine
-which specific transformation is causing the problem.  Ideally all passes
-would be instrumented to allow skipping of individual transformations.  This
-functionality is available through the OptBisect object but it is impractical
-to proactively instrument every existing pass.  It is hoped that as developers
-find that they need a pass to be instrumented they will add the instrumentation
-and contribute it back to the LLVM source base.
-
-Helper functions will be added to simplify this level of instrumentation, but
-this work is not yet completed.  For more information, contact Andy Kaylor.
+which specific transformation is causing the problem.  Debug counters
+can be used for this purpose.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30856.91439.patch
Type: text/x-patch
Size: 3401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170311/dc334a6e/attachment.bin>


More information about the llvm-commits mailing list