[lld] 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:
    lld/trunk/ELF/DWARF.cpp
    lld/trunk/ELF/InputSection.cpp

Modified: lld/trunk/ELF/DWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DWARF.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- lld/trunk/ELF/DWARF.cpp (original)
+++ lld/trunk/ELF/DWARF.cpp Sun Jun 30 04:19:56 2019
@@ -82,7 +82,7 @@ Optional<RelocAddrEntry>
 LLDDwarfObj<ELFT>::findAux(const InputSectionBase &Sec, uint64_t Pos,
                            ArrayRef<RelTy> Rels) const {
   auto It =
-      llvm::bsearch(Rels, [=](const RelTy &A) { return Pos <= A.r_offset; });
+      partition_point(Rels, [=](const RelTy &A) { return A.r_offset < Pos; });
   if (It == Rels.end() || It->r_offset != Pos)
     return None;
   const RelTy &Rel = *It;

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=364720&r1=364719&r2=364720&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Sun Jun 30 04:19:56 2019
@@ -1268,8 +1268,8 @@ SectionPiece *MergeInputSection::getSect
 
   // If Offset is not at beginning of a section piece, it is not in the map.
   // In that case we need to  do a binary search of the original section piece vector.
-  auto It = llvm::bsearch(Pieces,
-                          [=](SectionPiece P) { return Offset < P.InputOff; });
+  auto It = partition_point(
+      Pieces, [=](SectionPiece P) { return P.InputOff <= Offset; });
   return &It[-1];
 }
 




More information about the llvm-commits mailing list