From 1b49bce5bdb94e7df5322027e9be00e77c4f730b Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Wed, 13 Nov 2024 22:11:54 +0100 Subject: [PATCH] Revert "opt_merge: try pool?" This reverts commit 4db3e781a47f588ca8bbdbdfbb144dd86f55be1d. --- kernel/hashlib.h | 2 +- passes/opt/opt_merge.cc | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/kernel/hashlib.h b/kernel/hashlib.h index 2e3e07711ee..3be33ebd9ea 100644 --- a/kernel/hashlib.h +++ b/kernel/hashlib.h @@ -1002,7 +1002,7 @@ class pool constexpr pool() { } - pool (OPS ops) : ops(ops) { } + pool(const pool &other) { entries = other.entries; diff --git a/passes/opt/opt_merge.cc b/passes/opt/opt_merge.cc index 091c04f40cb..498cf014448 100644 --- a/passes/opt/opt_merge.cc +++ b/passes/opt/opt_merge.cc @@ -282,17 +282,24 @@ struct OptMergeWorker // We keep a set of known cells. They're hashed with our hash_cell_function // and compared with our compare_cell_parameters_and_connections. // Both need to capture OptMergeWorker to access initvals - struct CellPtrOps { + struct CellPtrHash { const OptMergeWorker& worker; - CellPtrOps(const OptMergeWorker& w) : worker(w) {} - Hasher hash(const Cell* c) const { - return worker.hash_cell_function(c, Hasher()); + CellPtrHash(const OptMergeWorker& w) : worker(w) {} + std::size_t operator()(const Cell* c) const { + return (std::size_t)worker.hash_cell_function(c, Hasher()).yield(); } - bool cmp(const Cell* lhs, const Cell* rhs) const { + }; + struct CellPtrEqual { + const OptMergeWorker& worker; + CellPtrEqual(const OptMergeWorker& w) : worker(w) {} + bool operator()(const Cell* lhs, const Cell* rhs) const { return worker.compare_cell_parameters_and_connections(lhs, rhs); } }; - pool known_cells (CellPtrOps(*this)); + std::unordered_set< + RTLIL::Cell*, + CellPtrHash, + CellPtrEqual> known_cells (0, CellPtrHash(*this), CellPtrEqual(*this)); for (auto cell : cells) {