From ec49cbe67d259bf0c6482058efc7211e6605c328 Mon Sep 17 00:00:00 2001 From: Hideto Ueno Date: Thu, 2 Mar 2023 16:22:04 +0900 Subject: [PATCH] [ExtractInstances] Fix nondeterminism with MapVector. (#4749) This fixes nondeterminism caused by iteration over DenseMap. Instead use MapVector to guarantee determinism. --- lib/Dialect/FIRRTL/Transforms/ExtractInstances.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Dialect/FIRRTL/Transforms/ExtractInstances.cpp b/lib/Dialect/FIRRTL/Transforms/ExtractInstances.cpp index 8ee38bef0ac9..1cf09fedbfc9 100644 --- a/lib/Dialect/FIRRTL/Transforms/ExtractInstances.cpp +++ b/lib/Dialect/FIRRTL/Transforms/ExtractInstances.cpp @@ -845,7 +845,7 @@ void ExtractInstancesPass::groupInstances() { // module. Note that we cannot group instances that landed in different parent // modules into the same submodule, so we use that parent module as a grouping // key. - SmallDenseMap, SmallVector> + llvm::MapVector, SmallVector> instsByWrapper; for (auto &[inst, info] : extractedInstances) { if (!info.wrapperModule.empty())