Skip to content

[llvm] Use llvm::binary_search (NFC) #136228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions llvm/include/llvm/Support/UnicodeCharRanges.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ class UnicodeCharSet {

/// Returns true if the character set contains the Unicode code point
/// \p C.
bool contains(uint32_t C) const {
return std::binary_search(Ranges.begin(), Ranges.end(), C);
}
bool contains(uint32_t C) const { return llvm::binary_search(Ranges, C); }

private:
/// Returns true if each of the ranges is a proper closed range
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/Mips/Mips16HardFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,7 @@ static const char *const IntrinsicInline[] = {
};

static bool isIntrinsicInline(Function *F) {
return std::binary_search(std::begin(IntrinsicInline),
std::end(IntrinsicInline), F->getName());
return llvm::binary_search(IntrinsicInline, F->getName());
}

// Returns of float, double and complex need to be handled with a helper
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Target/Mips/Mips16ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,7 @@ getOpndList(SmallVectorImpl<SDValue> &Ops,
if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(CLI.Callee)) {
Mips16Libcall Find = { RTLIB::UNKNOWN_LIBCALL, S->getSymbol() };

if (std::binary_search(std::begin(HardFloatLibCalls),
std::end(HardFloatLibCalls), Find))
if (llvm::binary_search(HardFloatLibCalls, Find))
LookupHelper = false;
else {
const char *Symbol = S->getSymbol();
Expand Down Expand Up @@ -469,8 +468,7 @@ getOpndList(SmallVectorImpl<SDValue> &Ops,
Mips16Libcall Find = { RTLIB::UNKNOWN_LIBCALL,
G->getGlobal()->getName().data() };

if (std::binary_search(std::begin(HardFloatLibCalls),
std::end(HardFloatLibCalls), Find))
if (llvm::binary_search(HardFloatLibCalls, Find))
LookupHelper = false;
}
if (LookupHelper)
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/Mips/MipsCCState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ bool MipsCCState::isF128SoftLibCall(const char *CallSym) {
// Check that LibCalls is sorted alphabetically.
auto Comp = [](const char *S1, const char *S2) { return strcmp(S1, S2) < 0; };
assert(llvm::is_sorted(LibCalls, Comp));
return std::binary_search(std::begin(LibCalls), std::end(LibCalls), CallSym,
Comp);
return llvm::binary_search(LibCalls, CallSym, Comp);
}

/// This function returns true if Ty is fp128, {f128} or i128 which was
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-cov/CodeCoverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ void CodeCoverageTool::removeUnmappedInputs(const CoverageMapping &Coverage) {
// The user may have specified source files which aren't in the coverage
// mapping. Filter these files away.
llvm::erase_if(SourceFiles, [&](const std::string &SF) {
return !std::binary_search(CoveredFiles.begin(), CoveredFiles.end(), SF);
return !llvm::binary_search(CoveredFiles, SF);
});
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/utils/TableGen/Common/CodeGenRegisters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,8 +922,7 @@ bool CodeGenRegisterClass::hasType(const ValueTypeByHwMode &VT) const {
}

bool CodeGenRegisterClass::contains(const CodeGenRegister *Reg) const {
return std::binary_search(Members.begin(), Members.end(), Reg,
deref<std::less<>>());
return llvm::binary_search(Members, Reg, deref<std::less<>>());
}

unsigned CodeGenRegisterClass::getWeight(const CodeGenRegBank &RegBank) const {
Expand Down
Loading