[llvm] c025bd1 - [TableGen,GlobalISel] Use MapVector to stabilize iteration order

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 17:21:27 PDT 2024


Author: Fangrui Song
Date: 2024-06-19T17:21:22-07:00
New Revision: c025bd1fdbbdbe76c450eb08ebd8649fb3179d5a

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

LOG: [TableGen,GlobalISel] Use MapVector to stabilize iteration order

Otherwise llvm/test/TableGen/GlobalISelCombinerEmitter/type-inference.td
could fail when llvm::hash_value(StringRef) changes.

Fix #66377

Added: 
    

Modified: 
    llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp b/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
index 085841ed963e4..e8fbaed0f50e8 100644
--- a/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
@@ -529,7 +529,7 @@ void CombineRuleOperandTypeChecker::getInstEqClasses(
   const auto MCOITypes = getMCOIOperandTypes(*CGP);
   assert(MCOITypes.size() == P.operands_size());
 
-  DenseMap<StringRef, std::vector<unsigned>> TyToOpIdx;
+  MapVector<StringRef, SmallVector<unsigned, 0>> TyToOpIdx;
   for (const auto &[Idx, Ty] : enumerate(MCOITypes))
     TyToOpIdx[Ty].push_back(Idx);
 


        


More information about the llvm-commits mailing list