From 01d2bfcf00b1de487558cbe026164c66d69b0b9c Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Wed, 12 Feb 2025 10:16:44 +0100 Subject: [PATCH] share: fix infinite loop in find_terminal_bits on $mux loop --- passes/opt/share.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passes/opt/share.cc b/passes/opt/share.cc index 6081d140e..40d6d1d20 100644 --- a/passes/opt/share.cc +++ b/passes/opt/share.cc @@ -87,7 +87,7 @@ struct ShareWorker queue_bits.clear(); for (auto &pbit : portbits) { - if (pbit.cell->type == ID($mux) || pbit.cell->type == ID($pmux)) { + if ((pbit.cell->type == ID($mux) || pbit.cell->type == ID($pmux)) && visited_cells.count(pbit.cell) == 0) { pool bits = modwalker.sigmap(pbit.cell->getPort(ID::S)).to_sigbit_pool(); terminal_bits.insert(bits.begin(), bits.end()); queue_bits.insert(bits.begin(), bits.end());