[llvm] r223875 - LiveInterval: Add const version of LiveRange::advanceTo().

Matthias Braun matze at braunis.de
Tue Dec 9 17:12:03 PST 2014


Author: matze
Date: Tue Dec  9 19:12:02 2014
New Revision: 223875

URL: http://llvm.org/viewvc/llvm-project?rev=223875&view=rev
Log:
LiveInterval: Add const version of LiveRange::advanceTo().

Modified:
    llvm/trunk/include/llvm/CodeGen/LiveInterval.h

Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=223875&r1=223874&r2=223875&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Tue Dec  9 19:12:02 2014
@@ -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.





More information about the llvm-commits mailing list