Skip to content

Commit 6ad55f1

Browse files
[DebugInfo] Avoid repeated hash lookups (NFC) (#128459)
1 parent 5c6453d commit 6ad55f1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,8 @@ LVScope *LVDWARFReader::processOneDie(const DWARFDie &InputDIE, LVScope *Parent,
565565
// Insert the newly created element into the element symbol table. If the
566566
// element is in the list, it means there are previously created elements
567567
// referencing this element.
568-
if (ElementTable.find(Offset) == ElementTable.end()) {
569-
// No previous references to this offset.
570-
ElementTable.emplace(std::piecewise_construct,
571-
std::forward_as_tuple(Offset),
572-
std::forward_as_tuple(CurrentElement));
573-
} else {
568+
auto [It, Inserted] = ElementTable.try_emplace(Offset, CurrentElement);
569+
if (!Inserted) {
574570
// There are previous references to this element. We need to update the
575571
// element and all the references pointing to this element.
576572
LVElementEntry &Reference = ElementTable[Offset];

0 commit comments

Comments
 (0)