From dcd7742d5220a2997eff9c80d699fd44ca2d2305 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Wed, 21 Jan 2026 04:02:02 +0000 Subject: [PATCH] Avoid scanning entire module if there are no wires to remove It's pretty common for `opt_clean` to find no wires to remove. In that case, there is no point scanning the entire design, which can be significantly expensive for huge designs. --- kernel/rtlil.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 42d5f56b6..eef1c319d 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -2990,6 +2990,8 @@ void RTLIL::Module::add(RTLIL::Binding *binding) void RTLIL::Module::remove(const pool &wires) { log_assert(refcount_wires_ == 0); + if (wires.empty()) + return; struct DeleteWireWorker {