diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-03 04:23:52 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-03 04:23:52 +0000 |
commit | b64f669b666098b8494660fbd08a18610be228d4 (patch) | |
tree | 5c0cc722cd28571a5d150d194e87bb18d4c10e6c /lib/CodeGen/LiveInterval.cpp | |
parent | 36d61863bc83bd2301e0224adc560098b35ec0dc (diff) |
Avoid comparing invalid slot indexes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r-- | lib/CodeGen/LiveInterval.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp index a37296f77b..f2345bc2c5 100644 --- a/lib/CodeGen/LiveInterval.cpp +++ b/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). |