[DWARF] Avoid repeated hash lookups (NFC) (#125633)
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 8bf5135..107e79c 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -967,21 +967,20 @@
// here because we validate this in the .debug_info verifier.
continue;
}
- auto Iter = StmtListToDie.find(LineTableOffset);
- if (Iter != StmtListToDie.end()) {
+ auto [Iter, Inserted] = StmtListToDie.try_emplace(LineTableOffset, Die);
+ if (!Inserted) {
++NumDebugLineErrors;
+ const auto &OldDie = Iter->second;
ErrorCategory.Report("Identical DW_AT_stmt_list section offset", [&]() {
error() << "two compile unit DIEs, "
- << format("0x%08" PRIx64, Iter->second.getOffset()) << " and "
+ << format("0x%08" PRIx64, OldDie.getOffset()) << " and "
<< format("0x%08" PRIx64, Die.getOffset())
<< ", have the same DW_AT_stmt_list section offset:\n";
- dump(Iter->second);
+ dump(OldDie);
dump(Die) << '\n';
});
// Already verified this line table before, no need to do it again.
- continue;
}
- StmtListToDie[LineTableOffset] = Die;
}
}