From cdd89530851c7befa416e6c161c1f529945e22c4 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 8 Sep 2023 21:52:33 -0400 Subject: [PATCH] Disable Subst when not pure --- src/V3Const.cpp | 2 +- src/V3Subst.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/V3Const.cpp b/src/V3Const.cpp index f43f31afe..b76c8244b 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -2053,7 +2053,7 @@ private: VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); return true; } - } else if (m_doV && VN_IS(nodep->lhsp(), Concat)) { + } else if (m_doV && VN_IS(nodep->lhsp(), Concat) && nodep->isTreePureRecurse()) { bool need_temp = false; if (m_warn && !VN_IS(nodep, AssignDly)) { // Is same var on LHS and RHS? // Note only do this (need user4) when m_warn, which is diff --git a/src/V3Subst.cpp b/src/V3Subst.cpp index eecb39579..38ebafb6a 100644 --- a/src/V3Subst.cpp +++ b/src/V3Subst.cpp @@ -198,7 +198,10 @@ private: } } void visit(AstConst*) override {} // Accelerate - void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { + if (!nodep->isPure()) m_ok = false; + iterateChildren(nodep); + } public: // CONSTRUCTORS