-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lld] Use llvm::partition_point (NFC) #145209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_20250621_llvm_partition_point_lld
Jun 22, 2025
Merged
[lld] Use llvm::partition_point (NFC) #145209
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_20250621_llvm_partition_point_lld
Jun 22, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-lld @llvm/pr-subscribers-lld-elf Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/145209.diff 2 Files Affected:
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
|
tgymnich
approved these changes
Jun 22, 2025
zmodem
added a commit
that referenced
this pull request
Jun 23, 2025
This caused assertion failures in applyBranchToBranchOpt(): llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From*) [with To = lld::elf::InputSection; From = lld::elf::InputSectionBase]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed. See comment on the PR (#138366) This reverts commit 491b82a. This also reverts the follow-up "[lld] Use llvm::partition_point (NFC) (#145209)" This reverts commit 2ac293f.
miguelcsx
pushed a commit
to miguelcsx/llvm-project
that referenced
this pull request
Jun 23, 2025
This caused assertion failures in applyBranchToBranchOpt(): llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From*) [with To = lld::elf::InputSection; From = lld::elf::InputSectionBase]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed. See comment on the PR (llvm#138366) This reverts commit 491b82a. This also reverts the follow-up "[lld] Use llvm::partition_point (NFC) (llvm#145209)" This reverts commit 2ac293f.
Jaddyen
pushed a commit
to Jaddyen/llvm-project
that referenced
this pull request
Jun 23, 2025
Jaddyen
pushed a commit
to Jaddyen/llvm-project
that referenced
this pull request
Jun 23, 2025
This caused assertion failures in applyBranchToBranchOpt(): llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From*) [with To = lld::elf::InputSection; From = lld::elf::InputSectionBase]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed. See comment on the PR (llvm#138366) This reverts commit 491b82a. This also reverts the follow-up "[lld] Use llvm::partition_point (NFC) (llvm#145209)" This reverts commit 2ac293f.
anthonyhatran
pushed a commit
to anthonyhatran/llvm-project
that referenced
this pull request
Jun 26, 2025
This caused assertion failures in applyBranchToBranchOpt(): llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From*) [with To = lld::elf::InputSection; From = lld::elf::InputSectionBase]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed. See comment on the PR (llvm#138366) This reverts commit 491b82a. This also reverts the follow-up "[lld] Use llvm::partition_point (NFC) (llvm#145209)" This reverts commit 2ac293f.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.