Fix splitting if statements with impure conditions (#5219)

This commit is contained in:
Bartłomiej Chmiel
2024-07-02 15:17:10 -04:00
committed by GitHub
parent 8bffb8c391
commit 955ed3f193
4 changed files with 113 additions and 3 deletions
+6 -3
View File
@@ -983,9 +983,12 @@ protected:
}
void visit(AstNodeIf* nodep) override {
UINFO(4, " IF " << nodep << endl);
m_curIfConditional = nodep;
iterateAndNextNull(nodep->condp());
m_curIfConditional = nullptr;
if (!nodep->condp()->isPure()) m_noReorderWhy = "Impure IF condition";
{
VL_RESTORER(m_curIfConditional);
m_curIfConditional = nodep;
iterateAndNextNull(nodep->condp());
}
scanBlock(nodep->thensp());
scanBlock(nodep->elsesp());
}