From 7daf917b51731dd7243dd248db9c8af9f60aa8ab Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Mon, 1 Sep 2025 03:36:03 +0000 Subject: [PATCH] In hash_cell_inputs, avoid constructing an std::pair (which requires copying the port IdString) --- kernel/hashlib.h | 6 ++++++ passes/opt/opt_merge.cc | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/hashlib.h b/kernel/hashlib.h index 9c53e6687..39530baea 100644 --- a/kernel/hashlib.h +++ b/kernel/hashlib.h @@ -188,6 +188,12 @@ template struct hash_ops> { return h; } HASH_TOP_LOOP_FST (const std::pair &a) HASH_TOP_LOOP_SND + [[nodiscard]] static inline Hasher hash(const P &p, const Q &q) { + Hasher h; + h = hash_ops

::hash_into(p, h); + h = hash_ops::hash_into(q, h); + return h; + } }; template struct hash_ops> { diff --git a/passes/opt/opt_merge.cc b/passes/opt/opt_merge.cc index ba8168e74..6c81ee241 100644 --- a/passes/opt/opt_merge.cc +++ b/passes/opt/opt_merge.cc @@ -107,7 +107,7 @@ struct OptMergeWorker for (const auto& [port, sig] : cell->connections()) { if (cell->output(port)) continue; - comm.eat(hash_ops>::hash({port, assign_map(sig)})); + comm.eat(hash_ops>::hash(port, assign_map(sig))); } h = comm.hash_into(h); if (RTLIL::builtin_ff_cell_types().count(cell->type))