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

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 10:52:03 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());
+  }
----------------
vporpo wrote:

I prefer top/bottom because it implies program order. From/To could be both top->down or bottom->up.
I will upload a separate NFC patch to switch from From/To to Top/Bottom. I

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


More information about the llvm-commits mailing list