Skip to content

[lld] Use llvm::count_if (NFC) #141519

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

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented May 26, 2025

@llvm/pr-subscribers-lld

@llvm/pr-subscribers-lld-wasm

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/141519.diff

1 Files Affected:

  • (modified) lld/wasm/InputChunks.cpp (+3-3)
diff --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp
index ffab83e636392..855589353e4f6 100644
--- a/lld/wasm/InputChunks.cpp
+++ b/lld/wasm/InputChunks.cpp
@@ -174,9 +174,9 @@ static bool relocIsLive(const WasmRelocation &rel, ObjFile *file) {
 }
 
 size_t InputChunk::getNumLiveRelocations() const {
-  return std::count_if(
-      relocations.begin(), relocations.end(),
-      [this](const WasmRelocation &rel) { return relocIsLive(rel, file); });
+  return llvm::count_if(relocations, [this](const WasmRelocation &rel) {
+    return relocIsLive(rel, file);
+  });
 }
 
 // Copy relocation entries to a given output stream.

@sbc100
Copy link
Collaborator

sbc100 commented May 27, 2025

Can you say in the PR description why the llvm one is preferable?

@kazutakahirata kazutakahirata merged commit 4dbc755 into llvm:main May 28, 2025
14 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250526_llvm_count_if_lld branch May 28, 2025 18:41
@sbc100
Copy link
Collaborator

sbc100 commented May 28, 2025

Can you say in the PR description why the llvm one is preferable?

@kazutakahirata, did you see this comment? It might seem obvious to some (you) but I think some context for the change would still be good.

@kazutakahirata
Copy link
Contributor Author

Can you say in the PR description why the llvm one is preferable?

@kazutakahirata, did you see this comment? It might seem obvious to some (you) but I think some context for the change would still be good.

@sbc100 Acknowledged.

sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants