[lld] [ELF] Remove dead stable_sort in TargetInfo::scanSectionImpl. NFC (PR #195601)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon May 4 00:19:03 PDT 2026
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/195601
Dead since the code is moved to target-specific relocation scanning.
>From 39d3cfbb306e8864ee9a0b9a1dfe442c4a6e7ebf Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Mon, 4 May 2026 00:17:49 -0700
Subject: [PATCH] [ELF] Remove dead stable_sort in TargetInfo::scanSectionImpl.
NFC
Dead since the code is moved to target-specific relocation scanning.
---
lld/ELF/Relocations.cpp | 8 --------
1 file changed, 8 deletions(-)
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 7b4d7217e0452..225ee0251295d 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1133,14 +1133,6 @@ void TargetInfo::scanSectionImpl(InputSectionBase &sec, Relocs<RelTy> rels) {
auto type = it->getType(false);
rs.scan<ELFT, RelTy>(it, type, rs.getAddend<ELFT>(*it, type));
}
-
- // Sort relocations by offset for more efficient searching for
- // R_RISCV_PCREL_HI20 and the branch-to-branch optimization.
- if (ctx.arg.emachine == EM_RISCV || ctx.arg.branchToBranch)
- llvm::stable_sort(sec.relocs(),
- [](const Relocation &lhs, const Relocation &rhs) {
- return lhs.offset < rhs.offset;
- });
}
template <class ELFT> void TargetInfo::scanSection1(InputSectionBase &sec) {
More information about the llvm-commits
mailing list