[llvm] [SandboxVec][InstrInterval] Add ArrayRef constructor (PR #109357)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 16:04:43 PDT 2024


================
@@ -80,6 +80,17 @@ class InstrInterval {
     assert((FromI == ToI || FromI->comesBefore(ToI)) &&
            "FromI should come before TopI!");
   }
+  InstrInterval(ArrayRef<Instruction *> Instrs) {
+    assert(!Instrs.empty() && "Expected non-empty Instrs!");
+    FromI = Instrs[0];
+    ToI = Instrs[0];
+    for (auto *I : drop_begin(Instrs)) {
+      if (I->comesBefore(FromI))
+        FromI = I;
+      if (ToI->comesBefore(I))
----------------
vporpo wrote:

I think you are right. Initially they both have the same value and from that point on FromI will always be before ToI, so if I comes before FromI it will never be after ToI

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


More information about the llvm-commits mailing list