[llvm] [dsymutil] Avoid repeated hash lookups (NFC) (PR #127449)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 16 22:17:58 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/127449
None
>From f5683b047dc9dd139b8c1e56232ca6ed3b391804 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 16 Feb 2025 08:30:35 -0800
Subject: [PATCH] [dsymutil] Avoid repeated hash lookups (NFC)
---
llvm/tools/dsymutil/BinaryHolder.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/llvm/tools/dsymutil/BinaryHolder.cpp b/llvm/tools/dsymutil/BinaryHolder.cpp
index 7588a33eb46b2..9429afeefa642 100644
--- a/llvm/tools/dsymutil/BinaryHolder.cpp
+++ b/llvm/tools/dsymutil/BinaryHolder.cpp
@@ -288,15 +288,13 @@ void BinaryHolder::eraseObjectEntry(StringRef Filename) {
if (isArchive(Filename)) {
StringRef ArchiveFilename = getArchiveAndObjectName(Filename).first;
std::lock_guard<std::mutex> Lock(ArchiveCacheMutex);
- ArchiveRefCounter[ArchiveFilename]--;
- if (ArchiveRefCounter[ArchiveFilename] == 0)
+ if (--ArchiveRefCounter[ArchiveFilename] == 0)
ArchiveCache.erase(ArchiveFilename);
return;
}
std::lock_guard<std::mutex> Lock(ObjectCacheMutex);
- ObjectRefCounter[Filename]--;
- if (ObjectRefCounter[Filename] == 0)
+ if (--ObjectRefCounter[Filename] == 0)
ObjectCache.erase(Filename);
}
More information about the llvm-commits
mailing list