[llvm] [BOLT] Use DenseMap::contains (NFC) (PR #167169)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 8 10:59:50 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/167169

Identified with readability-container-contains.


>From e0a436105628787f8c4abfb3eadc59ff34abe78b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 7 Nov 2025 09:24:15 -0800
Subject: [PATCH] [BOLT] Use DenseMap::contains (NFC)

Identified with readability-container-contains.
---
 bolt/lib/Core/DebugNames.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/lib/Core/DebugNames.cpp b/bolt/lib/Core/DebugNames.cpp
index 6be2c5aa4e6c1..5272d402be7f3 100644
--- a/bolt/lib/Core/DebugNames.cpp
+++ b/bolt/lib/Core/DebugNames.cpp
@@ -555,7 +555,7 @@ void DWARF5AcceleratorTable::populateAbbrevsMap() {
 
 void DWARF5AcceleratorTable::writeEntry(BOLTDWARF5AccelTableData &Entry) {
   const uint64_t EntryID = getEntryID(Entry);
-  if (EntryRelativeOffsets.find(EntryID) != EntryRelativeOffsets.end())
+  if (EntryRelativeOffsets.contains(EntryID))
     EntryRelativeOffsets[EntryID] = EntriesBuffer->size();
 
   const std::optional<DWARF5AccelTable::UnitIndexAndEncoding> EntryRet =



More information about the llvm-commits mailing list