Use llvm::upper_bound. NFC

llvm-svn: 358277
This commit is contained in:
Fangrui Song 2019-04-12 11:31:16 +00:00
parent eb312ddfdf
commit fb79ff6ab5
4 changed files with 8 additions and 13 deletions

View File

@ -336,11 +336,10 @@ void ExecutionDomainFix::visitSoftInstr(MachineInstr *mi, unsigned mask) {
}
// Sorted insertion.
// Enables giving priority to the latest domains during merging.
auto I = std::upper_bound(
Regs.begin(), Regs.end(), rx, [&](int LHS, const int RHS) {
return RDA->getReachingDef(mi, RC->getRegister(LHS)) <
RDA->getReachingDef(mi, RC->getRegister(RHS));
});
auto I = llvm::upper_bound(Regs, rx, [&](int LHS, const int RHS) {
return RDA->getReachingDef(mi, RC->getRegister(LHS)) <
RDA->getReachingDef(mi, RC->getRegister(RHS));
});
Regs.insert(I, rx);
}

View File

@ -506,9 +506,8 @@ LegalizerInfo::findAction(const SizeAndActionsVec &Vec, const uint32_t Size) {
// Find the last element in Vec that has a bitsize equal to or smaller than
// the requested bit size.
// That is the element just before the first element that is bigger than Size.
auto VecIt = std::upper_bound(
Vec.begin(), Vec.end(), Size,
[](const uint32_t Size, const SizeAndAction lhs) -> bool {
auto VecIt = llvm::upper_bound(
Vec, Size, [](const uint32_t Size, const SizeAndAction lhs) -> bool {
return Size < lhs.first;
});
assert(VecIt != Vec.begin() && "Does Vec not start with size 1?");

View File

@ -296,9 +296,7 @@ private:
iterator find(SlotIndex Pos) { return LR->find(Pos); }
iterator findInsertPos(Segment S) {
return std::upper_bound(LR->begin(), LR->end(), S.start);
}
iterator findInsertPos(Segment S) { return llvm::upper_bound(*LR, S.start); }
};
//===----------------------------------------------------------------------===//

View File

@ -693,8 +693,7 @@ bool RegisterCoalescer::hasOtherReachingDefs(LiveInterval &IntA,
for (LiveRange::Segment &ASeg : IntA.segments) {
if (ASeg.valno != AValNo) continue;
LiveInterval::iterator BI =
std::upper_bound(IntB.begin(), IntB.end(), ASeg.start);
LiveInterval::iterator BI = llvm::upper_bound(IntB, ASeg.start);
if (BI != IntB.begin())
--BI;
for (; BI != IntB.end() && ASeg.end >= BI->start; ++BI) {