Fix incorrect temporary insertion in loop conditions with statements (#4873)

When the condition of an AstWhile loop contains a statement (e.g.
through an AstExprStmt), temporaries inserted in that statement need to
go before that statement, not in the AstWhile precondition.
This commit is contained in:
Geza Lore
2024-02-04 09:19:54 -05:00
committed by GitHub
parent c702fc944e
commit 6ca60429ce
3 changed files with 50 additions and 1 deletions
+3 -1
View File
@@ -176,8 +176,10 @@ class PremitVisitor final : public VNVisitor {
if (stmtp->user1SetOnce()) return; \
VL_RESTORER(m_assignLhs); \
VL_RESTORER(m_stmtp); \
VL_RESTORER(m_inWhileCondp); \
m_assignLhs = false; \
m_stmtp = stmtp
m_stmtp = stmtp; \
m_inWhileCondp = nullptr
void visit(AstWhile* nodep) override {
UINFO(4, " WHILE " << nodep << endl);