[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
This commit is contained in:
Fangrui Song
2024-06-19 17:21:22 -07:00
parent 6d340e4c44
commit c025bd1fdb

View File

@@ -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);