[llvm] [OptBisect] Add support for selecting ranges of passes and refactor DebugCounter to use a shared Range API. (PR #152393)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 07:35:24 PDT 2025


================
@@ -0,0 +1,109 @@
+//===- llvm/Support/Range.h - Range parsing utility -----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file provides utilities for parsing range specifications like
+// "1-10,20-30,45" which are commonly used in debugging and bisection tools.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_RANGE_H
+#define LLVM_SUPPORT_RANGE_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+#include <cassert>
+#include <cstdint>
+
+namespace llvm {
+class raw_ostream;
+} // end namespace llvm
+
+namespace llvm {
+
+/// Represents a range of integers [Begin, End], inclusive on both ends, where
+/// Begin <= End.
+class Range {
----------------
kuhar wrote:

I don't think this is a good name for this -- it seems more similar to an `InservalSet`, no? https://github.com/llvm/llvm-project/blob/c2dc2f8d98c476337230be6c14c30cd42c7b8df6/orc-rt/include/orc-rt/IntervalSet.h

Could we promote one of the existing Interval data structures to ADT instead of adding a new non-generic one?

https://github.com/llvm/llvm-project/pull/152393


More information about the llvm-commits mailing list