[llvm] [DWARF] Avoid repeated hash lookups (NFC) (PR #110202)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 27 11:14:49 PDT 2024
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/110202
>From 70cffbb22975ab58d9a4291cec80430c2ef9a2f6 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 26 Sep 2024 08:26:54 -0700
Subject: [PATCH] [DWARF] Avoid repeated hash lookups (NFC)
---
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index eb2751ab30ac50..fa3e8ad21dbd4d 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -1014,10 +1014,8 @@ void DWARFVerifier::verifyDebugLineRows() {
DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, FullPath);
assert(HasFullPath && "Invalid index?");
(void)HasFullPath;
- auto It = FullPathMap.find(FullPath);
- if (It == FullPathMap.end())
- FullPathMap[FullPath] = FileIndex;
- else if (It->second != FileIndex && DumpOpts.Verbose) {
+ auto [It, Inserted] = FullPathMap.try_emplace(FullPath, FileIndex);
+ if (!Inserted && It->second != FileIndex && DumpOpts.Verbose) {
warn() << ".debug_line["
<< format("0x%08" PRIx64,
*toSectionOffset(Die.find(DW_AT_stmt_list)))
More information about the llvm-commits
mailing list