[lld] [lld] Use llvm::partition_point (NFC) (PR #145209)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 21 22:47:46 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/145209

None

>From fa348f8bbcea3226f58dd1a33bbdbb0c87b18b88 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 21 Jun 2025 08:24:51 -0700
Subject: [PATCH] [lld] Use llvm::partition_point (NFC)

---
 lld/ELF/Arch/AArch64.cpp | 5 ++---
 lld/ELF/Arch/X86_64.cpp  | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp
index f00c91b5886f3..1812f2af419d2 100644
--- a/lld/ELF/Arch/AArch64.cpp
+++ b/lld/ELF/Arch/AArch64.cpp
@@ -1003,9 +1003,8 @@ static std::optional<uint64_t> getControlTransferAddend(InputSection &is,
 
 static std::pair<Relocation *, uint64_t>
 getBranchInfoAtTarget(InputSection &is, uint64_t offset) {
-  auto *i =
-      std::partition_point(is.relocations.begin(), is.relocations.end(),
-                           [&](Relocation &r) { return r.offset < offset; });
+  auto *i = llvm::partition_point(
+      is.relocations, [&](Relocation &r) { return r.offset < offset; });
   if (i != is.relocations.end() && i->offset == offset &&
       i->type == R_AARCH64_JUMP26) {
     return {i, i->addend};
diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp
index b991b6f905b96..163505102d0ec 100644
--- a/lld/ELF/Arch/X86_64.cpp
+++ b/lld/ELF/Arch/X86_64.cpp
@@ -1193,9 +1193,8 @@ static std::pair<Relocation *, uint64_t>
 getBranchInfoAtTarget(InputSection &is, uint64_t offset) {
   auto content = is.contentMaybeDecompress();
   if (content.size() > offset && content[offset] == 0xe9) { // JMP immediate
-    auto *i = std::partition_point(
-        is.relocations.begin(), is.relocations.end(),
-        [&](Relocation &r) { return r.offset < offset + 1; });
+    auto *i = llvm::partition_point(
+        is.relocations, [&](Relocation &r) { return r.offset < offset + 1; });
     // Unlike with getControlTransferAddend() it is valid to accept a PC32
     // relocation here because we know that this is actually a JMP and not some
     // other reference, so the interpretation is that we add 4 to the addend and



More information about the llvm-commits mailing list