[llvm] abcab4f - [llvm-dwarfdump] Avoid repeated hash lookups (NFC) (#129991)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 6 08:50:03 PST 2025
Author: Kazu Hirata
Date: 2025-03-06T08:50:00-08:00
New Revision: abcab4f7baed5a231b38fba4ef47ae5c69fba7de
URL: https://github.com/llvm/llvm-project/commit/abcab4f7baed5a231b38fba4ef47ae5c69fba7de
DIFF: https://github.com/llvm/llvm-project/commit/abcab4f7baed5a231b38fba4ef47ae5c69fba7de.diff
LOG: [llvm-dwarfdump] Avoid repeated hash lookups (NFC) (#129991)
Added:
Modified:
llvm/tools/llvm-dwarfdump/Statistics.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-dwarfdump/Statistics.cpp b/llvm/tools/llvm-dwarfdump/Statistics.cpp
index 1670709c08314..af9a93ad35b9c 100644
--- a/llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ b/llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -529,8 +529,9 @@ static void collectStatsRecursive(
auto OffsetFn = Die.find(dwarf::DW_AT_abstract_origin);
if (OffsetFn) {
uint64_t OffsetOfInlineFnCopy = (*OffsetFn).getRawUValue();
- if (LocalAbstractOriginFnInfo.count(OffsetOfInlineFnCopy)) {
- AbstractOriginVars = LocalAbstractOriginFnInfo[OffsetOfInlineFnCopy];
+ if (auto It = LocalAbstractOriginFnInfo.find(OffsetOfInlineFnCopy);
+ It != LocalAbstractOriginFnInfo.end()) {
+ AbstractOriginVars = It->second;
AbstractOriginVarsPtr = &AbstractOriginVars;
} else {
// This means that the DW_AT_inline fn copy is out of order
@@ -782,9 +783,10 @@ static void collectZeroLocCovForVarsWithAbstractOrigin(
// If there is no entry within LocalAbstractOriginFnInfo for the given
// FnCopyRawUValue, function isn't out-of-order in DWARF. Rather, we have
// CrossCU referencing.
- if (!LocalAbstractOriginFnInfo.count(FnCopyRawUValue))
+ auto It = LocalAbstractOriginFnInfo.find(FnCopyRawUValue);
+ if (It == LocalAbstractOriginFnInfo.end())
continue;
- AbstractOriginVars = LocalAbstractOriginFnInfo[FnCopyRawUValue];
+ AbstractOriginVars = It->second;
updateVarsWithAbstractOriginLocCovInfo(FnDieWithAbstractOrigin,
AbstractOriginVars);
More information about the llvm-commits
mailing list