[llvm] r364720 - Cleanup: llvm::bsearch -> llvm::partition_point after r364719
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 30 04:19:56 PDT 2019
Author: maskray
Date: Sun Jun 30 04:19:56 2019
New Revision: 364720
URL: http://llvm.org/viewvc/llvm-project?rev=364720&view=rev
Log:
Cleanup: llvm::bsearch -> llvm::partition_point after r364719
Modified:
llvm/trunk/include/llvm/ADT/STLExtras.h
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h
llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
llvm/trunk/lib/CodeGen/ExecutionDomainFix.cpp
llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
llvm/trunk/lib/IR/DataLayout.cpp
llvm/trunk/lib/IR/Function.cpp
llvm/trunk/lib/ProfileData/InstrProf.cpp
llvm/trunk/lib/Target/X86/X86InstrFMA3Info.cpp
llvm/trunk/lib/TextAPI/MachO/InterfaceFile.cpp
llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
llvm/trunk/tools/dsymutil/DwarfLinker.cpp
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
llvm/trunk/unittests/ADT/STLExtrasTest.cpp
Modified: llvm/trunk/include/llvm/ADT/STLExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/STLExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/STLExtras.h Sun Jun 30 04:19:56 2019
@@ -1322,13 +1322,12 @@ void stable_sort(R &&Range, Compare C) {
std::stable_sort(adl_begin(Range), adl_end(Range), C);
}
-/// Binary search for the first iterator in a range where a predicate is true.
-/// Requires that C is always false below some limit, and always true above it.
+/// Binary search for the first iterator in a range where a predicate is false.
+/// Requires that C is always true below some limit, and always false above it.
template <typename R, typename Predicate,
typename Val = decltype(*adl_begin(std::declval<R>()))>
-auto bsearch(R &&Range, Predicate P) -> decltype(adl_begin(Range)) {
- return std::partition_point(adl_begin(Range), adl_end(Range),
- [&](const Val &V) { return !P(V); });
+auto partition_point(R &&Range, Predicate P) -> decltype(adl_begin(Range)) {
+ return std::partition_point(adl_begin(Range), adl_end(Range), P);
}
/// Wrapper function around std::equal to detect if all elements
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h Sun Jun 30 04:19:56 2019
@@ -473,9 +473,10 @@ public:
DWARFDie getDIEForOffset(uint32_t Offset) {
extractDIEsIfNeeded(false);
assert(!DieArray.empty());
- auto It = llvm::bsearch(DieArray, [=](const DWARFDebugInfoEntry &LHS) {
- return Offset <= LHS.getOffset();
- });
+ auto It =
+ llvm::partition_point(DieArray, [=](const DWARFDebugInfoEntry &DIE) {
+ return DIE.getOffset() < Offset;
+ });
if (It != DieArray.end() && It->getOffset() == Offset)
return DWARFDie(this, &*It);
return DWARFDie();
Modified: llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp Sun Jun 30 04:19:56 2019
@@ -60,8 +60,8 @@ static cl::opt<int> ProfileSummaryColdCo
// Find the summary entry for a desired percentile of counts.
static const ProfileSummaryEntry &getEntryForPercentile(SummaryEntryVector &DS,
uint64_t Percentile) {
- auto It = llvm::bsearch(DS, [=](const ProfileSummaryEntry &Entry) {
- return Percentile <= Entry.Cutoff;
+ auto It = partition_point(DS, [=](const ProfileSummaryEntry &Entry) {
+ return Entry.Cutoff < Percentile;
});
// The required percentile has to be <= one of the percentiles in the
// detailed summary.
Modified: llvm/trunk/lib/CodeGen/ExecutionDomainFix.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExecutionDomainFix.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ExecutionDomainFix.cpp (original)
+++ llvm/trunk/lib/CodeGen/ExecutionDomainFix.cpp Sun Jun 30 04:19:56 2019
@@ -337,8 +337,8 @@ void ExecutionDomainFix::visitSoftInstr(
// Sorted insertion.
// Enables giving priority to the latest domains during merging.
const int Def = RDA->getReachingDef(mi, RC->getRegister(rx));
- auto I = llvm::bsearch(Regs, [&](int I) {
- return Def < RDA->getReachingDef(mi, RC->getRegister(I));
+ auto I = partition_point(Regs, [&](int I) {
+ return RDA->getReachingDef(mi, RC->getRegister(I)) <= Def;
});
Regs.insert(I, rx);
}
Modified: llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp Sun Jun 30 04:19:56 2019
@@ -544,11 +544,10 @@ LegalizerInfo::findAction(const SizeAndA
// 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 = llvm::bsearch(
- Vec, [=](const SizeAndAction &A) { return Size < A.first; });
- assert(VecIt != Vec.begin() && "Does Vec not start with size 1?");
- --VecIt;
- int VecIdx = VecIt - Vec.begin();
+ auto It = partition_point(
+ Vec, [=](const SizeAndAction &A) { return A.first <= Size; });
+ assert(It != Vec.begin() && "Does Vec not start with size 1?");
+ int VecIdx = It - Vec.begin() - 1;
LegalizeAction Action = Vec[VecIdx].second;
switch (Action) {
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp Sun Jun 30 04:19:56 2019
@@ -115,7 +115,7 @@ void DWARFDebugAranges::construct() {
uint32_t DWARFDebugAranges::findAddress(uint64_t Address) const {
RangeCollIterator It =
- llvm::bsearch(Aranges, [=](Range RHS) { return Address < RHS.HighPC(); });
+ partition_point(Aranges, [=](Range R) { return R.HighPC() <= Address; });
if (It != Aranges.end() && It->LowPC <= Address)
return It->CUOffset;
return -1U;
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp Sun Jun 30 04:19:56 2019
@@ -532,8 +532,8 @@ void DWARFDebugFrame::parse(DWARFDataExt
}
FrameEntry *DWARFDebugFrame::getEntryAtOffset(uint64_t Offset) const {
- auto It = llvm::bsearch(Entries, [=](const std::unique_ptr<FrameEntry> &E) {
- return Offset <= E->getOffset();
+ auto It = partition_point(Entries, [=](const std::unique_ptr<FrameEntry> &E) {
+ return E->getOffset() < Offset;
});
if (It != Entries.end() && (*It)->getOffset() == Offset)
return It->get();
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp Sun Jun 30 04:19:56 2019
@@ -57,8 +57,8 @@ void DWARFDebugLoc::LocationList::dump(r
DWARFDebugLoc::LocationList const *
DWARFDebugLoc::getLocationListAtOffset(uint64_t Offset) const {
- auto It = llvm::bsearch(
- Locations, [=](const LocationList &L) { return Offset <= L.Offset; });
+ auto It = partition_point(
+ Locations, [=](const LocationList &L) { return L.Offset < Offset; });
if (It != Locations.end() && It->Offset == Offset)
return &(*It);
return nullptr;
@@ -212,8 +212,8 @@ void DWARFDebugLoclists::parse(DataExtra
DWARFDebugLoclists::LocationList const *
DWARFDebugLoclists::getLocationListAtOffset(uint64_t Offset) const {
- auto It = llvm::bsearch(
- Locations, [=](const LocationList &L) { return Offset <= L.Offset; });
+ auto It = partition_point(
+ Locations, [=](const LocationList &L) { return L.Offset < Offset; });
if (It != Locations.end() && It->Offset == Offset)
return &(*It);
return nullptr;
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp Sun Jun 30 04:19:56 2019
@@ -172,8 +172,8 @@ DWARFUnitIndex::getFromOffset(uint32_t O
E2->Contributions[InfoColumn].Offset;
});
}
- auto I = llvm::bsearch(OffsetLookup, [&](Entry *E2) {
- return Offset < E2->Contributions[InfoColumn].Offset;
+ auto I = partition_point(OffsetLookup, [&](Entry *E2) {
+ return E2->Contributions[InfoColumn].Offset <= Offset;
});
if (I == OffsetLookup.begin())
return nullptr;
Modified: llvm/trunk/lib/IR/DataLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DataLayout.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DataLayout.cpp (original)
+++ llvm/trunk/lib/IR/DataLayout.cpp Sun Jun 30 04:19:56 2019
@@ -463,8 +463,8 @@ DataLayout::AlignmentsTy::iterator
DataLayout::findAlignmentLowerBound(AlignTypeEnum AlignType,
uint32_t BitWidth) {
auto Pair = std::make_pair((unsigned)AlignType, BitWidth);
- return llvm::bsearch(Alignments, [=](const LayoutAlignElem &E) {
- return Pair <= std::make_pair(E.AlignType, E.TypeBitWidth);
+ return partition_point(Alignments, [=](const LayoutAlignElem &E) {
+ return std::make_pair(E.AlignType, E.TypeBitWidth) < Pair;
});
}
Modified: llvm/trunk/lib/IR/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Function.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Function.cpp (original)
+++ llvm/trunk/lib/IR/Function.cpp Sun Jun 30 04:19:56 2019
@@ -533,9 +533,8 @@ static ArrayRef<const char *> findTarget
// Drop "llvm." and take the first dotted component. That will be the target
// if this is target specific.
StringRef Target = Name.drop_front(5).split('.').first;
- auto It = llvm::bsearch(Targets, [=](const IntrinsicTargetInfo &TI) {
- return Target <= TI.Name;
- });
+ auto It = partition_point(
+ Targets, [=](const IntrinsicTargetInfo &TI) { return TI.Name < Target; });
// We've either found the target or just fall back to the generic set, which
// is always first.
const auto &TI = It != Targets.end() && It->Name == Target ? *It : Targets[0];
Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProf.cpp Sun Jun 30 04:19:56 2019
@@ -363,16 +363,15 @@ Error InstrProfSymtab::create(Module &M,
uint64_t InstrProfSymtab::getFunctionHashFromAddress(uint64_t Address) {
finalizeSymtab();
- auto Result =
- llvm::bsearch(AddrToMD5Map, [=](std::pair<uint64_t, uint64_t> A) {
- return Address <= A.first;
- });
+ auto It = partition_point(AddrToMD5Map, [=](std::pair<uint64_t, uint64_t> A) {
+ return A.first < Address;
+ });
// Raw function pointer collected by value profiler may be from
// external functions that are not instrumented. They won't have
// mapping data to be used by the deserializer. Force the value to
// be 0 in this case.
- if (Result != AddrToMD5Map.end() && Result->first == Address)
- return (uint64_t)Result->second;
+ if (It != AddrToMD5Map.end() && It->first == Address)
+ return (uint64_t)It->second;
return 0;
}
Modified: llvm/trunk/lib/Target/X86/X86InstrFMA3Info.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFMA3Info.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrFMA3Info.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrFMA3Info.cpp Sun Jun 30 04:19:56 2019
@@ -158,8 +158,8 @@ const X86InstrFMA3Group *llvm::getFMA3Gr
// FMA 231 instructions have an opcode of 0xB6-0xBF
unsigned FormIndex = ((BaseOpcode - 0x90) >> 4) & 0x3;
- auto I = llvm::bsearch(Table, [=](const X86InstrFMA3Group &Group) {
- return Opcode <= Group.Opcodes[FormIndex];
+ auto I = partition_point(Table, [=](const X86InstrFMA3Group &Group) {
+ return Group.Opcodes[FormIndex] < Opcode;
});
assert(I != Table.end() && I->Opcodes[FormIndex] == Opcode &&
"Couldn't find FMA3 opcode!");
Modified: llvm/trunk/lib/TextAPI/MachO/InterfaceFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TextAPI/MachO/InterfaceFile.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/TextAPI/MachO/InterfaceFile.cpp (original)
+++ llvm/trunk/lib/TextAPI/MachO/InterfaceFile.cpp Sun Jun 30 04:19:56 2019
@@ -14,17 +14,15 @@
#include <iomanip>
#include <sstream>
-using namespace llvm::MachO;
-
namespace llvm {
namespace MachO {
namespace detail {
template <typename C>
typename C::iterator addEntry(C &Container, StringRef InstallName) {
- auto I = llvm::bsearch(Container, [=](const InterfaceFileRef &O) {
- return InstallName <= O.getInstallName();
+ auto I = partition_point(Container, [=](const InterfaceFileRef &O) {
+ return O.getInstallName() < InstallName;
});
- if ((I != std::end(Container)) && !(InstallName < I->getInstallName()))
+ if (I != Container.end() && I->getInstallName() == InstallName)
return I;
return Container.emplace(I, InstallName);
@@ -44,10 +42,10 @@ void InterfaceFile::addReexportedLibrary
}
void InterfaceFile::addUUID(Architecture Arch, StringRef UUID) {
- auto I =
- llvm::bsearch(UUIDs, [=](const std::pair<Architecture, std::string> &O) {
- return Arch <= O.first;
- });
+ auto I = partition_point(UUIDs,
+ [=](const std::pair<Architecture, std::string> &O) {
+ return O.first < Arch;
+ });
if (I != UUIDs.end() && Arch == I->first) {
I->second = UUID;
Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Sun Jun 30 04:19:56 2019
@@ -278,8 +278,8 @@ void MemsetRanges::addRange(int64_t Star
unsigned Alignment, Instruction *Inst) {
int64_t End = Start+Size;
- range_iterator I = llvm::bsearch(
- Ranges, [=](const MemsetRange &O) { return Start <= O.End; });
+ range_iterator I = partition_point(
+ Ranges, [=](const MemsetRange &O) { return O.End < Start; });
// We now know that I == E, in which case we didn't find anything to merge
// with, or that Start <= I->End. If End < I->Start or I == E, then we need
Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Sun Jun 30 04:19:56 2019
@@ -1767,8 +1767,8 @@ static void insertLineSequence(std::vect
}
object::SectionedAddress Front = Seq.front().Address;
- auto InsertPoint = llvm::bsearch(
- Rows, [=](const DWARFDebugLine::Row &O) { return !(O.Address < Front); });
+ auto InsertPoint = partition_point(
+ Rows, [=](const DWARFDebugLine::Row &O) { return O.Address < Front; });
// FIXME: this only removes the unneeded end_sequence if the
// sequences have been inserted in order. Using a global sort like
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Sun Jun 30 04:19:56 2019
@@ -973,14 +973,15 @@ static bool shouldAdjustVA(const Section
typedef std::pair<uint64_t, char> MappingSymbolPair;
static char getMappingSymbolKind(ArrayRef<MappingSymbolPair> MappingSymbols,
uint64_t Address) {
- auto Sym = bsearch(MappingSymbols, [Address](const MappingSymbolPair &Val) {
- return Val.first > Address;
- });
+ auto It =
+ partition_point(MappingSymbols, [Address](const MappingSymbolPair &Val) {
+ return Val.first <= Address;
+ });
// Return zero for any address before the first mapping symbol; this means
// we should use the default disassembly mode, depending on the target.
- if (Sym == MappingSymbols.begin())
+ if (It == MappingSymbols.begin())
return '\x00';
- return (Sym - 1)->second;
+ return (It - 1)->second;
}
static uint64_t
@@ -1119,9 +1120,9 @@ static void disassembleObject(const Targ
error(ExportEntry.getExportRVA(RVA));
uint64_t VA = COFFObj->getImageBase() + RVA;
- auto Sec = llvm::bsearch(
- SectionAddresses, [VA](const std::pair<uint64_t, SectionRef> &RHS) {
- return VA < RHS.first;
+ auto Sec = partition_point(
+ SectionAddresses, [VA](const std::pair<uint64_t, SectionRef> &O) {
+ return O.first <= VA;
});
if (Sec != SectionAddresses.begin()) {
--Sec;
@@ -1378,10 +1379,10 @@ static void disassembleObject(const Targ
// N.B. We don't walk the relocations in the relocatable case yet.
auto *TargetSectionSymbols = &Symbols;
if (!Obj->isRelocatableObject()) {
- auto It = llvm::bsearch(
+ auto It = partition_point(
SectionAddresses,
- [=](const std::pair<uint64_t, SectionRef> &RHS) {
- return Target < RHS.first;
+ [=](const std::pair<uint64_t, SectionRef> &O) {
+ return O.first <= Target;
});
if (It != SectionAddresses.begin()) {
--It;
@@ -1394,17 +1395,17 @@ static void disassembleObject(const Targ
// Find the last symbol in the section whose offset is less than
// or equal to the target. If there isn't a section that contains
// the target, find the nearest preceding absolute symbol.
- auto TargetSym = llvm::bsearch(
+ auto TargetSym = partition_point(
*TargetSectionSymbols,
- [=](const std::tuple<uint64_t, StringRef, uint8_t> &RHS) {
- return Target < std::get<0>(RHS);
+ [=](const std::tuple<uint64_t, StringRef, uint8_t> &O) {
+ return std::get<0>(O) <= Target;
});
if (TargetSym == TargetSectionSymbols->begin()) {
TargetSectionSymbols = &AbsoluteSymbols;
- TargetSym = llvm::bsearch(
+ TargetSym = partition_point(
AbsoluteSymbols,
- [=](const std::tuple<uint64_t, StringRef, uint8_t> &RHS) {
- return Target < std::get<0>(RHS);
+ [=](const std::tuple<uint64_t, StringRef, uint8_t> &O) {
+ return std::get<0>(O) <= Target;
});
}
if (TargetSym != TargetSectionSymbols->begin()) {
Modified: llvm/trunk/unittests/ADT/STLExtrasTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/STLExtrasTest.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/STLExtrasTest.cpp (original)
+++ llvm/trunk/unittests/ADT/STLExtrasTest.cpp Sun Jun 30 04:19:56 2019
@@ -469,13 +469,14 @@ TEST(STLExtrasTest, to_address) {
EXPECT_EQ(V1, to_address(V3));
}
-TEST(STLExtrasTest, bsearch) {
+TEST(STLExtrasTest, partition_point) {
std::vector<int> V = {1, 3, 5, 7, 9};
// Range version.
- EXPECT_EQ(V.begin() + 3, bsearch(V, [](unsigned X) { return X >= 7; }));
- EXPECT_EQ(V.begin(), bsearch(V, [](unsigned X) { return X >= 1; }));
- EXPECT_EQ(V.end(), bsearch(V, [](unsigned X) { return X >= 50; }));
+ EXPECT_EQ(V.begin() + 3,
+ partition_point(V, [](unsigned X) { return X < 7; }));
+ EXPECT_EQ(V.begin(), partition_point(V, [](unsigned X) { return X < 1; }));
+ EXPECT_EQ(V.end(), partition_point(V, [](unsigned X) { return X < 50; }));
}
} // namespace
More information about the llvm-commits
mailing list