LiveInterval: Add const version of LiveRange::advanceTo().
authorMatthias Braun <matze@braunis.de>
Wed, 10 Dec 2014 01:12:02 +0000 (01:12 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 10 Dec 2014 01:12:02 +0000 (01:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223875 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/LiveInterval.h

index 6629e6046532f624ae7f14a8d05d32bd2b747db2..9b1b65a7ae2435bf634b9e4cbc07bd2c894ccb13 100644 (file)
@@ -217,6 +217,14 @@ namespace llvm {
       return I;
     }
 
+    const_iterator advanceTo(const_iterator I, SlotIndex Pos) const {
+      assert(I != end());
+      if (Pos >= endIndex())
+        return end();
+      while (I->end <= Pos) ++I;
+      return I;
+    }
+
     /// find - Return an iterator pointing to the first segment that ends after
     /// Pos, or end(). This is the same as advanceTo(begin(), Pos), but faster
     /// when searching large ranges.