aboutsummaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-06-27 19:25:26 -0700
committerFangrui Song <i@maskray.me>2022-06-27 19:25:26 -0700
commitf1e27716cf218d9923235f5f28e663a8da83ce89 (patch)
treed2e882e6b1c0504a56b2b55324db5f10a28cd11a /llvm
parentde4a57cb21a19179d7be830967e642b868a05a91 (diff)
downloadllvm-f1e27716cf218d9923235f5f28e663a8da83ce89.zip
llvm-f1e27716cf218d9923235f5f28e663a8da83ce89.tar.gz
llvm-f1e27716cf218d9923235f5f28e663a8da83ce89.tar.bz2
[LiveInterval] Simplify with partition_point. NFC
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/LiveInterval.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index 9ded0fb..9378aae 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/lib/CodeGen/LiveInterval.cpp
@@ -348,23 +348,8 @@ 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_point(*this,
+ [&](const Segment &X) { return X.end <= Pos; });
}
VNInfo *LiveRange::createDeadDef(SlotIndex Def, VNInfo::Allocator &VNIAlloc) {