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 <h.zeller@acm.org>
This commit is contained in:
Henner Zeller 2019-09-29 00:17:40 -07:00
parent c372e7baf9
commit 8c2b4f0a50
1 changed files with 2 additions and 0 deletions

View File

@ -3083,6 +3083,7 @@ void RTLIL::SigSpec::replace(const dict<RTLIL::SigBit, RTLIL::SigBit> &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<RTLIL::SigBit, RTLIL::SigBit> &rules
log_assert(other != NULL);
log_assert(width_ == other->width_);
if (rules.empty()) return;
unpack();
other->unpack();