diff options
author | Fangrui Song <i@maskray.me> | 2022-06-25 11:59:33 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-06-25 11:59:33 -0700 |
commit | e733b80f3cba26bf2df9bd691120f37fc1af21ce (patch) | |
tree | 48880458e080afa574ef63db4a2d505d3f67ca62 /llvm/lib/CodeGen/LiveInterval.cpp | |
parent | 3b7c3a654c9175f41ac871a937cbcae73dfb3c5d (diff) | |
download | llvm-e733b80f3cba26bf2df9bd691120f37fc1af21ce.zip llvm-e733b80f3cba26bf2df9bd691120f37fc1af21ce.tar.gz llvm-e733b80f3cba26bf2df9bd691120f37fc1af21ce.tar.bz2 |
[LiveInterval] Simplify. NFC
Diffstat (limited to 'llvm/lib/CodeGen/LiveInterval.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveInterval.cpp | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp index 9ded0fb..0303d80 100644 --- a/llvm/lib/CodeGen/LiveInterval.cpp +++ b/llvm/lib/CodeGen/LiveInterval.cpp @@ -348,23 +348,7 @@ private: //===----------------------------------------------------------------------===// LiveRange::iterator LiveRange::find(SlotIndex Pos) { - // This algorithm is basically std::upper_bound. - // Unfortunately, std::upper_bound cannot be used with mixed types until we - // adopt C++0x. Many libraries can do it, but not all. - if (empty() || Pos >= endIndex()) - return end(); - iterator I = begin(); - size_t Len = size(); - do { - size_t Mid = Len >> 1; - if (Pos < I[Mid].end) { - Len = Mid; - } else { - I += Mid + 1; - Len -= Mid + 1; - } - } while (Len); - return I; + return llvm::partition(*this, [&](const Segment &X) { return X.end <= Pos; }); } VNInfo *LiveRange::createDeadDef(SlotIndex Def, VNInfo::Allocator &VNIAlloc) { |