summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-04-17 07:58:05 +0000
committerFangrui Song <maskray@google.com>2019-04-17 07:58:05 +0000
commitc82e92bca89f3b9740e8c66afae0298965c3183a (patch)
tree7731c7923970f33e032136221a4ea177659a7ccf /llvm/lib
parentb0b65cae592206d49e155bfc6ed0cbcf368061f4 (diff)
downloadbcm5719-llvm-c82e92bca89f3b9740e8c66afae0298965c3183a.tar.gz
bcm5719-llvm-c82e92bca89f3b9740e8c66afae0298965c3183a.zip
Change some llvm::{lower,upper}_bound to llvm::bsearch. NFC
llvm-svn: 358564
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp6
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp4
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp10
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp7
4 files changed, 10 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
index 5dca699827b..17609175951 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
@@ -506,10 +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 = llvm::upper_bound(
- Vec, Size, [](const uint32_t Size, const SizeAndAction lhs) -> bool {
- return Size < lhs.first;
- });
+ 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();
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
index a28313676eb..010b0106a83 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
@@ -115,9 +115,7 @@ void DWARFDebugAranges::construct() {
uint32_t DWARFDebugAranges::findAddress(uint64_t Address) const {
RangeCollIterator It =
- llvm::upper_bound(Aranges, Address, [](uint64_t LHS, Range RHS) {
- return LHS < RHS.HighPC();
- });
+ llvm::bsearch(Aranges, [=](Range RHS) { return Address < RHS.HighPC(); });
if (It != Aranges.end() && It->LowPC <= Address)
return It->CUOffset;
return -1U;
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
index 7c80b3bb3e9..e0d62215d9b 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
@@ -57,9 +57,8 @@ void DWARFDebugLoc::LocationList::dump(raw_ostream &OS, bool IsLittleEndian,
DWARFDebugLoc::LocationList const *
DWARFDebugLoc::getLocationListAtOffset(uint64_t Offset) const {
- auto It = llvm::lower_bound(
- Locations, Offset,
- [](const LocationList &L, uint64_t Offset) { return L.Offset < Offset; });
+ auto It = llvm::bsearch(
+ Locations, [=](const LocationList &L) { return Offset <= L.Offset; });
if (It != Locations.end() && It->Offset == Offset)
return &(*It);
return nullptr;
@@ -213,9 +212,8 @@ void DWARFDebugLoclists::parse(DataExtractor data, unsigned Version) {
DWARFDebugLoclists::LocationList const *
DWARFDebugLoclists::getLocationListAtOffset(uint64_t Offset) const {
- auto It = llvm::lower_bound(
- Locations, Offset,
- [](const LocationList &L, uint64_t Offset) { return L.Offset < Offset; });
+ auto It = llvm::bsearch(
+ Locations, [=](const LocationList &L) { return Offset <= L.Offset; });
if (It != Locations.end() && It->Offset == Offset)
return &(*It);
return nullptr;
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
index 8225a26d64c..cff5c288d06 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
@@ -172,10 +172,9 @@ DWARFUnitIndex::getFromOffset(uint32_t Offset) const {
E2->Contributions[InfoColumn].Offset;
});
}
- auto I =
- llvm::upper_bound(OffsetLookup, Offset, [&](uint32_t Offset, Entry *E2) {
- return Offset < E2->Contributions[InfoColumn].Offset;
- });
+ auto I = llvm::bsearch(OffsetLookup, [&](Entry *E2) {
+ return Offset < E2->Contributions[InfoColumn].Offset;
+ });
if (I == OffsetLookup.begin())
return nullptr;
--I;
OpenPOWER on IntegriCloud