From b296386d2ca8595c23bc2f90eef902f3c485b1a0 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 22 Nov 2025 15:30:43 -0800 Subject: [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. --- llvm/lib/CodeGen/CallingConvLower.cpp | 3 +-- llvm/lib/TextAPI/InterfaceFile.cpp | 11 +++++------ 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 LHS, - const std::shared_ptr RHS) { - return *LHS == *RHS; - })) + if (!llvm::equal(Documents, O.Documents, + [](const std::shared_ptr &LHS, + const std::shared_ptr &RHS) { + return *LHS == *RHS; + })) return false; return true; } -- cgit v1.2.3