Skip to content

Commit

Permalink
[LiveInterval] Simplify with partition_point. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Jun 28, 2022
1 parent de4a57c commit f1e2771
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions llvm/lib/CodeGen/LiveInterval.cpp
Expand Up @@ -348,23 +348,8 @@ class CalcLiveRangeUtilSet : public CalcLiveRangeUtilSetBase {
//===----------------------------------------------------------------------===//

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) {
Expand Down

0 comments on commit f1e2771

Please sign in to comment.