[llvm] e88fee1 - AppleAcceleratorTable: Use MapVector to stabilize iteration order after D153066

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 19:59:17 PDT 2023


Author: Fangrui Song
Date: 2023-07-19T19:59:13-07:00
New Revision: e88fee1fec6e69b7a1d55242146e9e311eebaba0

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

LOG: AppleAcceleratorTable: Use MapVector to stabilize iteration order after D153066

Use a MapVector to stabilize the order and simplify future changes like
D142862 that change the StringMap hash function.

Added: 
    

Modified: 
    llvm/test/DebugInfo/Generic/apple-names-hash-collisions.ll
    llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/DebugInfo/Generic/apple-names-hash-collisions.ll b/llvm/test/DebugInfo/Generic/apple-names-hash-collisions.ll
index 5664ec91d895fd..20dfdec6887150 100644
--- a/llvm/test/DebugInfo/Generic/apple-names-hash-collisions.ll
+++ b/llvm/test/DebugInfo/Generic/apple-names-hash-collisions.ll
@@ -15,14 +15,14 @@
 ; FOUND_VARS: DW_AT_name        ("bb")
 ; FOUND_VARS: DW_AT_name        ("cA")
 
+; ALL_ENTRIES: Apple accelerator entries with name = "bb":
+; ALL_ENTRIES: DW_AT_name        ("bb")
 ; ALL_ENTRIES: Apple accelerator entries with name = "cA":
 ; ALL_ENTRIES: DW_AT_name        ("cA")
 ; ALL_ENTRIES: Apple accelerator entries with name = "some_other_hash":
 ; ALL_ENTRIES: DW_AT_name        ("some_other_hash")
 ; ALL_ENTRIES: Apple accelerator entries with name = "int":
 ; ALL_ENTRIES: DW_AT_name        ("int")
-; ALL_ENTRIES: Apple accelerator entries with name = "bb":
-; ALL_ENTRIES: DW_AT_name        ("bb")
 
 @bb = global i32 200, align 4, !dbg !0
 @cA = global i32 10, align 4, !dbg !5

diff  --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index cdcb5bbd8ab991..156e10c84dddec 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -11,6 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm-dwarfdump.h"
+#include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringSet.h"
@@ -463,7 +464,7 @@ static void filterByAccelName(
 static void findAllApple(
     DWARFContext &DICtx, raw_ostream &OS,
     std::function<StringRef(uint64_t RegNum, bool IsEH)> GetNameForDWARFReg) {
-  StringMap<llvm::SmallSet<DWARFDie, 2>> NameToDies;
+  MapVector<StringRef, llvm::SmallSet<DWARFDie, 2>> NameToDies;
 
   auto PushDIEs = [&](const AppleAcceleratorTable &Accel) {
     for (const auto &Entry : Accel.entries()) {


        


More information about the llvm-commits mailing list