Skip to content

Commit 5928876

Browse files
[llvm] Use llvm::binary_search (NFC) (#136228)
1 parent 65d16a8 commit 5928876

File tree

6 files changed

+7
-14
lines changed

6 files changed

+7
-14
lines changed

llvm/include/llvm/Support/UnicodeCharRanges.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ class UnicodeCharSet {
6161

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

6866
private:
6967
/// Returns true if each of the ranges is a proper closed range

llvm/lib/Target/Mips/Mips16HardFloat.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,7 @@ static const char *const IntrinsicInline[] = {
369369
};
370370

371371
static bool isIntrinsicInline(Function *F) {
372-
return std::binary_search(std::begin(IntrinsicInline),
373-
std::end(IntrinsicInline), F->getName());
372+
return llvm::binary_search(IntrinsicInline, F->getName());
374373
}
375374

376375
// Returns of float, double and complex need to be handled with a helper

llvm/lib/Target/Mips/Mips16ISelLowering.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,7 @@ getOpndList(SmallVectorImpl<SDValue> &Ops,
427427
if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(CLI.Callee)) {
428428
Mips16Libcall Find = { RTLIB::UNKNOWN_LIBCALL, S->getSymbol() };
429429

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

472-
if (std::binary_search(std::begin(HardFloatLibCalls),
473-
std::end(HardFloatLibCalls), Find))
471+
if (llvm::binary_search(HardFloatLibCalls, Find))
474472
LookupHelper = false;
475473
}
476474
if (LookupHelper)

llvm/lib/Target/Mips/MipsCCState.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ bool MipsCCState::isF128SoftLibCall(const char *CallSym) {
3030
// Check that LibCalls is sorted alphabetically.
3131
auto Comp = [](const char *S1, const char *S2) { return strcmp(S1, S2) < 0; };
3232
assert(llvm::is_sorted(LibCalls, Comp));
33-
return std::binary_search(std::begin(LibCalls), std::end(LibCalls), CallSym,
34-
Comp);
33+
return llvm::binary_search(LibCalls, CallSym, Comp);
3534
}
3635

3736
/// This function returns true if Ty is fp128, {f128} or i128 which was

llvm/tools/llvm-cov/CodeCoverage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ void CodeCoverageTool::removeUnmappedInputs(const CoverageMapping &Coverage) {
547547
// The user may have specified source files which aren't in the coverage
548548
// mapping. Filter these files away.
549549
llvm::erase_if(SourceFiles, [&](const std::string &SF) {
550-
return !std::binary_search(CoveredFiles.begin(), CoveredFiles.end(), SF);
550+
return !llvm::binary_search(CoveredFiles, SF);
551551
});
552552
}
553553

llvm/utils/TableGen/Common/CodeGenRegisters.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,8 +922,7 @@ bool CodeGenRegisterClass::hasType(const ValueTypeByHwMode &VT) const {
922922
}
923923

924924
bool CodeGenRegisterClass::contains(const CodeGenRegister *Reg) const {
925-
return std::binary_search(Members.begin(), Members.end(), Reg,
926-
deref<std::less<>>());
925+
return llvm::binary_search(Members, Reg, deref<std::less<>>());
927926
}
928927

929928
unsigned CodeGenRegisterClass::getWeight(const CodeGenRegBank &RegBank) const {

0 commit comments

Comments
 (0)