[llvm] 99f6cb8 - [BPF] Use heterogeneous lookup with std::map (NFC) (#143395)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 07:12:42 PDT 2025


Author: Kazu Hirata
Date: 2025-06-10T07:12:38-07:00
New Revision: 99f6cb89352f7491e8cd3cc58c6d1ba687c99b27

URL: https://github.com/llvm/llvm-project/commit/99f6cb89352f7491e8cd3cc58c6d1ba687c99b27
DIFF: https://github.com/llvm/llvm-project/commit/99f6cb89352f7491e8cd3cc58c6d1ba687c99b27.diff

LOG: [BPF] Use heterogeneous lookup with std::map (NFC) (#143395)

Added: 
    

Modified: 
    llvm/lib/Target/BPF/BTFDebug.cpp
    llvm/lib/Target/BPF/BTFDebug.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp
index 978cd9ab2106e..1d7c6fc799ff3 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -1438,7 +1438,7 @@ void BTFDebug::processGlobals(bool ProcessingMapDef) {
     // constant with private linkage and if it won't be in .rodata.str<#>
     // and .rodata.cst<#> sections.
     if (SecName == ".rodata" && Global.hasPrivateLinkage() &&
-        DataSecEntries.find(std::string(SecName)) == DataSecEntries.end()) {
+        DataSecEntries.find(SecName) == DataSecEntries.end()) {
       // skip .rodata.str<#> and .rodata.cst<#> sections
       if (!GVKind->isMergeableCString() && !GVKind->isMergeableConst()) {
         DataSecEntries[std::string(SecName)] =

diff  --git a/llvm/lib/Target/BPF/BTFDebug.h b/llvm/lib/Target/BPF/BTFDebug.h
index b24a79de74efa..75858fcc8bfde 100644
--- a/llvm/lib/Target/BPF/BTFDebug.h
+++ b/llvm/lib/Target/BPF/BTFDebug.h
@@ -300,7 +300,8 @@ class BTFDebug : public DebugHandlerBase {
   std::map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable;
   std::map<uint32_t, std::vector<BTFFieldReloc>> FieldRelocTable;
   StringMap<std::vector<std::string>> FileContent;
-  std::map<std::string, std::unique_ptr<BTFKindDataSec>> DataSecEntries;
+  std::map<std::string, std::unique_ptr<BTFKindDataSec>, std::less<>>
+      DataSecEntries;
   std::vector<BTFTypeStruct *> StructTypes;
   std::map<const GlobalVariable *, std::pair<int64_t, uint32_t>> PatchImms;
   std::map<const DICompositeType *,


        


More information about the llvm-commits mailing list