[llvm] [SandboxVec][Interval] Implement Interval::comesBefore() (PR #112026)

Sriraman Tallam via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 10:49:42 PDT 2024


================
@@ -127,6 +127,12 @@ template <typename T> class Interval {
   }
   /// Inequality.
   bool operator!=(const Interval &Other) const { return !(*this == Other); }
+  /// \Returns true if this interval comes before \p Other in program order.
+  /// This expects disjoint intervals.
+  bool comesBefore(const Interval &Other) const {
+    assert(disjoint(Other) && "Expect disjoint intervals!");
+    return bottom()->comesBefore(Other.top());
+  }
----------------
tmsri wrote:

Interval defines both {top, bottom} and {From, To} which are the same thing.  Should we just drop one?  Why not just have only {From, To} and from() and to().

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


More information about the llvm-commits mailing list