diff options
| author | Jack Koenig | 2020-05-12 23:27:57 -0700 |
|---|---|---|
| committer | Jack Koenig | 2020-05-13 18:36:57 -0700 |
| commit | 71e922c0ece775b21769ef8f4dc46ce160a21fb2 (patch) | |
| tree | 79a8491f71acd708805259ea3c96ef27b2f375ac /src/main | |
| parent | 36227e961a1fa0626249d71edd8b6c829a79a2ee (diff) | |
Remove accidental hashing of all Modules in Dedup
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/scala/firrtl/transforms/Dedup.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/scala/firrtl/transforms/Dedup.scala b/src/main/scala/firrtl/transforms/Dedup.scala index f9e9db48..d0df9e32 100644 --- a/src/main/scala/firrtl/transforms/Dedup.scala +++ b/src/main/scala/firrtl/transforms/Dedup.scala @@ -427,7 +427,11 @@ object DedupModules { val dedupedName2module = tag2name.map({ case (tag, name) => name -> DedupModules.dedupInstances(top, name, moduleMap, name2name, renameMap) }) // Build map from original name to corresponding deduped module - val name2module = tag2all.flatMap({ case (tag, names) => names.map(n => n -> dedupedName2module(tag2name(tag))) }) + // It is important to flatMap before looking up the DefModules so that they aren't hashed + val name2module: Map[String, DefModule] = + tag2all.flatMap { case (tag, names) => names.map(_ -> tag) } + .mapValues(tag => dedupedName2module(tag2name(tag))) + .toMap // Build renameMap val indexedTargets = mutable.HashMap[String, IndexedSeq[ReferenceTarget]]() @@ -439,7 +443,7 @@ object DedupModules { } } - name2module.toMap + name2module } def computeIndexedNames(main: String, m: DefModule): IndexedSeq[ReferenceTarget] = { |
