From ae466b170361af49beac5c827638fbec9a3ab6e2 Mon Sep 17 00:00:00 2001 From: Kamil Rakoczy Date: Wed, 14 Sep 2022 13:37:51 +0200 Subject: [PATCH] Internals: Improve Verilation peak memory usage in V3Subst (#3512). --- src/V3Subst.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/V3Subst.cpp b/src/V3Subst.cpp index ef7562ac5..ce43a7fd0 100644 --- a/src/V3Subst.cpp +++ b/src/V3Subst.cpp @@ -359,6 +359,13 @@ private: } virtual void visit(AstVar*) override {} virtual void visit(AstConst*) override {} + virtual void visit(AstModule* nodep) override { + ++m_ops; + if (!nodep->isSubstOptimizable()) m_ops = SUBST_MAX_OPS_NA; + iterateChildren(nodep); + // Reduce peak memory usage by reclaiming the edited AstNodes + doDeletes(); + } virtual void visit(AstNode* nodep) override { m_ops++; if (!nodep->isSubstOptimizable()) m_ops = SUBST_MAX_OPS_NA;