From a04dddf7a17ec6d90d2f8df9b54e517794c0f0f8 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Thu, 3 Mar 2011 04:23:52 +0000 Subject: Avoid comparing invalid slot indexes. llvm-svn: 126922 --- llvm/lib/CodeGen/LiveInterval.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'llvm/lib/CodeGen/LiveInterval.cpp') diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp index a37296f77b0..f2345bc2c58 100644 --- a/llvm/lib/CodeGen/LiveInterval.cpp +++ b/llvm/lib/CodeGen/LiveInterval.cpp @@ -33,16 +33,18 @@ using namespace llvm; // CompEnd - Compare LiveRange ends. namespace { struct CompEnd { - bool operator()(const LiveRange &A, const LiveRange &B) const { - return A.end < B.end; + bool operator()(SlotIndex A, const LiveRange &B) const { + return A < B.end; + } + bool operator()(const LiveRange &A, SlotIndex B) const { + return A.end < B; } }; } LiveInterval::iterator LiveInterval::find(SlotIndex Pos) { assert(Pos.isValid() && "Cannot search for an invalid index"); - return std::upper_bound(begin(), end(), LiveRange(SlotIndex(), Pos, 0), - CompEnd()); + return std::upper_bound(begin(), end(), Pos, CompEnd()); } /// killedInRange - Return true if the interval has kills in [Start,End). -- cgit v1.2.3