Fix huge case statement performance. Closes #1644.

Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
Julien Margetts 2019-12-23 07:47:57 -05:00 committed by Wilson Snyder
parent 49db4d2b66
commit c1fb938a61
2 changed files with 8 additions and 1 deletions

View File

@ -28,6 +28,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix disable iff in assertions. Closes #1404. [Peter Monsson]
**** Fix huge case statement performance. Closes #1644. [Julien Margetts]
* Verilator 4.024 2019-12-08

View File

@ -210,7 +210,12 @@ private:
return false;
}
}
if (m_caseItems <= 3) return false; // Not worth simplifying
if (m_caseItems <= 3
// Avoid e.g. priority expanders from going crazy in expansion
|| (m_caseWidth >= 8 && (m_caseItems <= (m_caseWidth + 1)))) {
return false; // Not worth simplifying
}
// Convert valueItem from AstCaseItem* to the expression
// Not done earlier, as we may now have a NULL because it's just a ";" NOP branch
for (uint32_t i=0; i<(1UL<<m_caseWidth); ++i) {