From 8c2b4f0a50678f949418b7b7329550615fadde83 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Sun, 29 Sep 2019 00:17:40 -0700 Subject: [PATCH] Avoid work in replace() if rules empty. This speeds up processing when number of bits are large but there is actually nothing to replace. Adresses part of #1382. Signed-off-by: Henner Zeller --- kernel/rtlil.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 1d380135b..17be28f78 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -3083,6 +3083,7 @@ void RTLIL::SigSpec::replace(const dict &rules, RT log_assert(other != NULL); log_assert(width_ == other->width_); + if (rules.empty()) return; unpack(); other->unpack(); @@ -3107,6 +3108,7 @@ void RTLIL::SigSpec::replace(const std::map &rules log_assert(other != NULL); log_assert(width_ == other->width_); + if (rules.empty()) return; unpack(); other->unpack(); -- 2.30.2