From 04210ee30acd437bccfe694ddd895e5f450ba01f Mon Sep 17 00:00:00 2001 From: Jared Barocsi Date: Thu, 29 Jul 2021 16:31:08 -0700 Subject: Dedup attribute annos (#2297) * Add new util "groupByIntoSeq" * Restore annotation order when dedupping annotations * Attribute annotations now deduplicate * Implement doc string anno dedup Co-authored-by: Jack Koenig --- src/main/scala/firrtl/transforms/DedupAnnotations.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/scala/firrtl/transforms') diff --git a/src/main/scala/firrtl/transforms/DedupAnnotations.scala b/src/main/scala/firrtl/transforms/DedupAnnotations.scala index 9355b5c3..cad4d2be 100644 --- a/src/main/scala/firrtl/transforms/DedupAnnotations.scala +++ b/src/main/scala/firrtl/transforms/DedupAnnotations.scala @@ -6,7 +6,7 @@ package transforms import firrtl.ir._ import firrtl.Mappers._ import firrtl.options.Dependency -import firrtl.Utils.BoolType +import firrtl.Utils.{groupByIntoSeq, BoolType} import firrtl.annotations.Annotation import scala.collection.mutable.Buffer import firrtl.annotations.MemoryFileInlineAnnotation @@ -61,7 +61,7 @@ object DedupAnnotationsTransform { } // Partition the dedupable annotations into groups that *should* deduplicate into the same annotation - val shouldDedup: Map[Any, ArrayBuffer[DedupableRepr]] = canDedup.groupBy(_.dedupKey) + val shouldDedup: Seq[(Any, Seq[DedupableRepr])] = groupByIntoSeq(canDedup)(_.dedupKey) shouldDedup.foreach { case ((target: ReferenceTarget, _), dedupableAnnos) => val originalAnnos = dedupableAnnos.map(_.original) -- cgit v1.2.3