aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-03-03 04:23:52 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-03-03 04:23:52 +0000
commita04dddf7a17ec6d90d2f8df9b54e517794c0f0f8 (patch)
tree98ee5e67bee6ec8e5c15e3cfe0ccf5a828ff6060 /llvm/lib/CodeGen/LiveInterval.cpp
parent9a6382fc818e246fdb3addc9a60d78cce870ded6 (diff)
downloadllvm-a04dddf7a17ec6d90d2f8df9b54e517794c0f0f8.zip
llvm-a04dddf7a17ec6d90d2f8df9b54e517794c0f0f8.tar.gz
llvm-a04dddf7a17ec6d90d2f8df9b54e517794c0f0f8.tar.bz2
Avoid comparing invalid slot indexes.
llvm-svn: 126922
Diffstat (limited to 'llvm/lib/CodeGen/LiveInterval.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveInterval.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index a37296f..f2345bc 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).