diff options
author | Daniel Thornburgh <dthorn@google.com> | 2023-01-30 13:19:05 -0800 |
---|---|---|
committer | Daniel Thornburgh <dthorn@google.com> | 2023-01-30 13:36:02 -0800 |
commit | 0a51eeda1ef43d0f9a73ed2ac15f602262943ea1 (patch) | |
tree | cc13a52850b1c943cf5bcdab5fd4f7667520756e /llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | |
parent | 0eb01a9c4581a24c163f3464cebdb20534fbda35 (diff) | |
download | llvm-0a51eeda1ef43d0f9a73ed2ac15f602262943ea1.zip llvm-0a51eeda1ef43d0f9a73ed2ac15f602262943ea1.tar.gz llvm-0a51eeda1ef43d0f9a73ed2ac15f602262943ea1.tar.bz2 |
[NFC] [llvm-cov] Remove unnecessary logic from llvm-cov debuginfod.
Indexed profiles already have a sorted and uniqued binary ID list, and
due to this, duplicates are harmless in the list of binary IDs found,
since it's set_differenced from the list in the indexed profile.
Differential Revision: https://reviews.llvm.org/D136702
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMapping.cpp')
-rw-r--r-- | llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp index 6b7fe1a..ce71eeb 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp @@ -410,30 +410,21 @@ CoverageMapping::load(ArrayRef<StringRef> ObjectFilenames, } if (BIDFetcher) { - const auto &CompareLT = [](object::BuildIDRef A, object::BuildIDRef B) { - return StringRef(reinterpret_cast<const char *>(A.data()), A.size()) < - StringRef(reinterpret_cast<const char *>(B.data()), B.size()); - }; - const auto &CompareEQ = [](object::BuildIDRef A, object::BuildIDRef B) { - return StringRef(reinterpret_cast<const char *>(A.data()), A.size()) == - StringRef(reinterpret_cast<const char *>(B.data()), B.size()); - }; std::vector<object::BuildID> ProfileBinaryIDs; if (Error E = ProfileReader->readBinaryIds(ProfileBinaryIDs)) return createFileError(ProfileFilename, std::move(E)); - llvm::sort(ProfileBinaryIDs, CompareLT); - ProfileBinaryIDs.erase(llvm::unique(ProfileBinaryIDs, CompareEQ), - ProfileBinaryIDs.end()); SmallVector<object::BuildIDRef> BinaryIDsToFetch; if (!ProfileBinaryIDs.empty()) { - llvm::sort(FoundBinaryIDs, CompareLT); - FoundBinaryIDs.erase(llvm::unique(FoundBinaryIDs, CompareEQ), - FoundBinaryIDs.end()); + const auto &Compare = [](object::BuildIDRef A, object::BuildIDRef B) { + return std::lexicographical_compare(A.begin(), A.end(), B.begin(), + B.end()); + }; + llvm::sort(FoundBinaryIDs, Compare); std::set_difference( ProfileBinaryIDs.begin(), ProfileBinaryIDs.end(), FoundBinaryIDs.begin(), FoundBinaryIDs.end(), - std::inserter(BinaryIDsToFetch, BinaryIDsToFetch.end()), CompareLT); + std::inserter(BinaryIDsToFetch, BinaryIDsToFetch.end()), Compare); } for (object::BuildIDRef BinaryID : BinaryIDsToFetch) { |