[llvm] [llvm-dwarfdump] Avoid repeated hash lookups (NFC) (PR #129991)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 5 21:58:17 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-debuginfo
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/129991.diff
1 Files Affected:
- (modified) llvm/tools/llvm-dwarfdump/Statistics.cpp (+6-4)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/129991
More information about the llvm-commits
mailing list