summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-11-22 15:30:43 -0800
committerGitHub <noreply@github.com>2025-11-22 15:30:43 -0800
commitb296386d2ca8595c23bc2f90eef902f3c485b1a0 (patch)
treee0f4ba2480ad012241ddc8644aa74b3cfa1b053f
parent637299e7e079b7d80f508691103092753d282ffa (diff)
[llvm] Use llvm::equal (NFC) (#169173)
While I am at it, this patch uses const l-value references for std::shared_ptr. We don't need to increment the reference count by passing std::shared_ptr by value. Identified with llvm-use-ranges.
-rw-r--r--llvm/lib/CodeGen/CallingConvLower.cpp3
-rw-r--r--llvm/lib/TextAPI/InterfaceFile.cpp11
2 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/CallingConvLower.cpp b/llvm/lib/CodeGen/CallingConvLower.cpp
index df3433199681..644e9bff8929 100644
--- a/llvm/lib/CodeGen/CallingConvLower.cpp
+++ b/llvm/lib/CodeGen/CallingConvLower.cpp
@@ -290,6 +290,5 @@ bool CCState::resultsCompatible(CallingConv::ID CalleeCC,
llvm_unreachable("Unknown location kind");
};
- return std::equal(RVLocs1.begin(), RVLocs1.end(), RVLocs2.begin(),
- RVLocs2.end(), AreCompatible);
+ return llvm::equal(RVLocs1, RVLocs2, AreCompatible);
}
diff --git a/llvm/lib/TextAPI/InterfaceFile.cpp b/llvm/lib/TextAPI/InterfaceFile.cpp
index a201554de9e6..b35f7fdd3a20 100644
--- a/llvm/lib/TextAPI/InterfaceFile.cpp
+++ b/llvm/lib/TextAPI/InterfaceFile.cpp
@@ -421,12 +421,11 @@ bool InterfaceFile::operator==(const InterfaceFile &O) const {
return false;
}
- if (!std::equal(Documents.begin(), Documents.end(), O.Documents.begin(),
- O.Documents.end(),
- [](const std::shared_ptr<InterfaceFile> LHS,
- const std::shared_ptr<InterfaceFile> RHS) {
- return *LHS == *RHS;
- }))
+ if (!llvm::equal(Documents, O.Documents,
+ [](const std::shared_ptr<InterfaceFile> &LHS,
+ const std::shared_ptr<InterfaceFile> &RHS) {
+ return *LHS == *RHS;
+ }))
return false;
return true;
}