From 70af6bd7c9987ce2ed113d7f564b8b49590bd494 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 4 Mar 2025 20:37:58 +0100 Subject: [PATCH] Another refinement for DSS bug solution --- src/db/db/dbDeepShapeStore.cc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/db/db/dbDeepShapeStore.cc b/src/db/db/dbDeepShapeStore.cc index c6bbb6aee..9a2cd9599 100644 --- a/src/db/db/dbDeepShapeStore.cc +++ b/src/db/db/dbDeepShapeStore.cc @@ -1320,10 +1320,28 @@ DeepShapeStore::cell_mapping_to_original (unsigned int layout_index, db::Layout into_layout->force_update (); - std::set cells_to_delete; + std::set vars; for (auto vv = new_variants.begin (); vv != new_variants.end (); ++vv) { - if (into_layout->cell (vv->second).parent_cells () == 0) { - cells_to_delete.insert (vv->second); + vars.insert (vv->second); + } + + std::set cells_to_delete; + + bool more = true; + while (more) { + more = false; + for (auto v = vars.begin (); v != vars.end (); ++v) { + if (cells_to_delete.find (*v) == cells_to_delete.end ()) { + const db::Cell &vc = into_layout->cell (*v); + bool used = false; + for (auto p = vc.begin_parent_cells (); p != vc.end_parent_cells () && ! used; ++p) { + used = (cells_to_delete.find (*p) == cells_to_delete.end ()); + } + if (! used) { + cells_to_delete.insert (*v); + more = true; + } + } } }