[llvm] b296386 - [llvm] Use llvm::equal (NFC) (#169173)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 22 15:30:47 PST 2025
Author: Kazu Hirata
Date: 2025-11-22T15:30:43-08:00
New Revision: b296386d2ca8595c23bc2f90eef902f3c485b1a0
URL: https://github.com/llvm/llvm-project/commit/b296386d2ca8595c23bc2f90eef902f3c485b1a0
DIFF: https://github.com/llvm/llvm-project/commit/b296386d2ca8595c23bc2f90eef902f3c485b1a0.diff
LOG: [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.
Added:
Modified:
llvm/lib/CodeGen/CallingConvLower.cpp
llvm/lib/TextAPI/InterfaceFile.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/CallingConvLower.cpp b/llvm/lib/CodeGen/CallingConvLower.cpp
index df3433199681b..644e9bff8929a 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 a201554de9e64..b35f7fdd3a207 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;
}
More information about the llvm-commits
mailing list