/// Check whether the CPU string is valid.
bool isCPUStringValid(StringRef CPU) const {
- auto Found = std::lower_bound(ProcDesc.begin(), ProcDesc.end(), CPU);
+ auto Found = llvm::lower_bound(ProcDesc, CPU);
return Found != ProcDesc.end() && StringRef(Found->Key) == CPU;
}
StringRef InstrProfSymtab::getFuncName(uint64_t FuncMD5Hash) {
finalizeSymtab();
- auto Result =
- std::lower_bound(MD5NameMap.begin(), MD5NameMap.end(), FuncMD5Hash,
- [](const std::pair<uint64_t, StringRef> &LHS,
- uint64_t RHS) { return LHS.first < RHS; });
+ auto Result = llvm::lower_bound(MD5NameMap, FuncMD5Hash,
+ [](const std::pair<uint64_t, StringRef> &LHS,
+ uint64_t RHS) { return LHS.first < RHS; });
if (Result != MD5NameMap.end() && Result->first == FuncMD5Hash)
return Result->second;
return StringRef();
Function* InstrProfSymtab::getFunction(uint64_t FuncMD5Hash) {
finalizeSymtab();
- auto Result =
- std::lower_bound(MD5FuncMap.begin(), MD5FuncMap.end(), FuncMD5Hash,
- [](const std::pair<uint64_t, Function*> &LHS,
- uint64_t RHS) { return LHS.first < RHS; });
+ auto Result = llvm::lower_bound(MD5FuncMap, FuncMD5Hash,
+ [](const std::pair<uint64_t, Function *> &LHS,
+ uint64_t RHS) { return LHS.first < RHS; });
if (Result != MD5FuncMap.end() && Result->first == FuncMD5Hash)
return Result->second;
return nullptr;
if (Offset >= getLength())
return make_error<BinaryStreamError>(stream_error_code::stream_too_short);
++Offset;
- auto Iter =
- std::lower_bound(ItemEndOffsets.begin(), ItemEndOffsets.end(), Offset);
+ auto Iter = llvm::lower_bound(ItemEndOffsets, Offset);
size_t Idx = std::distance(ItemEndOffsets.begin(), Iter);
assert(Idx < Items.size() && "binary search for offset failed");
return Idx;
NonLocalDepEntry Val = Cache.back();
Cache.pop_back();
MemoryDependenceResults::NonLocalDepInfo::iterator Entry =
- std::upper_bound(Cache.begin(), Cache.end(), Val);
+ llvm::upper_bound(Cache, Val);
Cache.insert(Entry, Val);
}
break;
/// Similar to DWARFUnitSection::getUnitForOffset(), but returning our
/// CompileUnit object instead.
static CompileUnit *getUnitForOffset(const UnitListTy &Units, uint64_t Offset) {
- auto CU = std::upper_bound(
- Units.begin(), Units.end(), Offset,
- [](uint64_t LHS, const std::unique_ptr<CompileUnit> &RHS) {
+ auto CU = llvm::upper_bound(
+ Units, Offset, [](uint64_t LHS, const std::unique_ptr<CompileUnit> &RHS) {
return LHS < RHS->getOrigUnit().getNextUnitOffset();
});
return CU != Units.end() ? CU->get() : nullptr;
if (PartialOffsets.empty())
return fullScanForType(TI);
- auto Next = std::upper_bound(PartialOffsets.begin(), PartialOffsets.end(), TI,
- [](TypeIndex Value, const TypeIndexOffset &IO) {
- return Value < IO.Type;
- });
+ auto Next = llvm::upper_bound(PartialOffsets, TI,
+ [](TypeIndex Value, const TypeIndexOffset &IO) {
+ return Value < IO.Type;
+ });
assert(Next != PartialOffsets.begin());
auto Prev = std::prev(Next);
UsedBytes |= ChildBytes;
if (ChildBytes.count() > 0) {
- auto Loc = std::upper_bound(LayoutItems.begin(), LayoutItems.end(), Begin,
- [](uint32_t Off, const LayoutItemBase *Item) {
- return (Off < Item->getOffsetInParent());
- });
+ auto Loc = llvm::upper_bound(
+ LayoutItems, Begin, [](uint32_t Off, const LayoutItemBase *Item) {
+ return (Off < Item->getOffsetInParent());
+ });
LayoutItems.insert(Loc, Child.get());
}
llvm::stable_sort(LoadSegments, SortPred);
}
- const Elf_Phdr *const *I =
- std::upper_bound(LoadSegments.begin(), LoadSegments.end(), VAddr,
- [](uint64_t VAddr, const Elf_Phdr_Impl<ELFT> *Phdr) {
- return VAddr < Phdr->p_vaddr;
- });
+ const Elf_Phdr *const *I = llvm::upper_bound(
+ LoadSegments, VAddr, [](uint64_t VAddr, const Elf_Phdr_Impl<ELFT> *Phdr) {
+ return VAddr < Phdr->p_vaddr;
+ });
if (I == LoadSegments.begin())
return createError("virtual address is not in any segment: 0x" +
const GPUInfo *getArchEntry(AMDGPU::GPUKind AK, ArrayRef<GPUInfo> Table) {
GPUInfo Search = { {""}, {""}, AK, AMDGPU::FEATURE_NONE };
- auto I = std::lower_bound(Table.begin(), Table.end(), Search,
- [](const GPUInfo &A, const GPUInfo &B) {
- return A.Kind < B.Kind;
- });
+ auto I =
+ llvm::lower_bound(Table, Search, [](const GPUInfo &A, const GPUInfo &B) {
+ return A.Kind < B.Kind;
+ });
if (I == Table.end())
return nullptr;
SetTagZeroFn(SetTagZeroFn), StgpFn(StgpFn) {}
bool addRange(uint64_t Start, uint64_t End, Instruction *Inst) {
- auto I = std::lower_bound(
- Ranges.begin(), Ranges.end(), Start,
- [](const Range &LHS, uint64_t RHS) { return LHS.End <= RHS; });
+ auto I =
+ llvm::lower_bound(Ranges, Start, [](const Range &LHS, uint64_t RHS) {
+ return LHS.End <= RHS;
+ });
if (I != Ranges.end() && End > I->Start) {
// Overlap - bail.
return false;
"CpuPfmCounters table is not sorted");
// Find entry
- auto Found =
- std::lower_bound(CpuPfmCounters.begin(), CpuPfmCounters.end(), CpuName);
+ auto Found = llvm::lower_bound(CpuPfmCounters, CpuName);
if (Found == CpuPfmCounters.end() || StringRef(Found->CpuName) != CpuName) {
// Use the default.
if (CpuPfmCounters.begin() != CpuPfmCounters.end() &&
// using lower bound operation
uint32_t getIndexForAddr(uint64_t Address) const {
uint64_t Offset = virtualAddrToOffset(Address);
- auto Low = std::lower_bound(CodeAddrs.begin(), CodeAddrs.end(), Offset);
+ auto Low = llvm::lower_bound(CodeAddrs, Offset);
return Low - CodeAddrs.begin();
}
{
auto E =
std::make_pair(Top, Top->ExtraData.TerminalDurations.size());
- TopStacksByCount.insert(std::lower_bound(TopStacksByCount.begin(),
- TopStacksByCount.end(), E,
- greater_second),
- E);
+ TopStacksByCount.insert(
+ llvm::lower_bound(TopStacksByCount, E, greater_second), E);
if (TopStacksByCount.size() == 11)
TopStacksByCount.pop_back();
}
DefInit *DI = cast<DefInit>(V->getValue());
Record *Alias = DI->getDef();
- const auto &AliasIter =
- std::lower_bound(DwarfRegNums.begin(), DwarfRegNums.end(), Alias,
- [](const DwarfRegNumsMapPair &A, const Record *B) {
- return LessRecordRegister()(A.first, B);
- });
+ const auto &AliasIter = llvm::lower_bound(
+ DwarfRegNums, Alias, [](const DwarfRegNumsMapPair &A, const Record *B) {
+ return LessRecordRegister()(A.first, B);
+ });
assert(AliasIter != DwarfRegNums.end() && AliasIter->first == Alias &&
"Expected Alias to be present in map");
- const auto &RegIter =
- std::lower_bound(DwarfRegNums.begin(), DwarfRegNums.end(), Reg,
- [](const DwarfRegNumsMapPair &A, const Record *B) {
- return LessRecordRegister()(A.first, B);
- });
+ const auto &RegIter = llvm::lower_bound(
+ DwarfRegNums, Reg, [](const DwarfRegNumsMapPair &A, const Record *B) {
+ return LessRecordRegister()(A.first, B);
+ });
assert(RegIter != DwarfRegNums.end() && RegIter->first == Reg &&
"Expected Reg to be present in map");
RegIter->second = AliasIter->second;