From e01cf6e4c0697ebece1df42288b8718a2d7dae69 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 10 Dec 2014 01:12:02 +0000 Subject: [PATCH] LiveInterval: Add const version of LiveRange::advanceTo(). llvm-svn: 223875 --- llvm/include/llvm/CodeGen/LiveInterval.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/llvm/include/llvm/CodeGen/LiveInterval.h b/llvm/include/llvm/CodeGen/LiveInterval.h index 6629e60..9b1b65a 100644 --- a/llvm/include/llvm/CodeGen/LiveInterval.h +++ b/llvm/include/llvm/CodeGen/LiveInterval.h @@ -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. -- 2.7.4