From 718ebd4506a21e7fda79b88beed7b64cbc2d2eb9 Mon Sep 17 00:00:00 2001 From: Yutetsu TAKATSUKASA Date: Fri, 17 Jan 2020 06:42:09 +0900 Subject: [PATCH] Add an ovbious optimization. --- src/V3SplitVar.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/V3SplitVar.cpp b/src/V3SplitVar.cpp index 1625c16d0..b6a692698 100644 --- a/src/V3SplitVar.cpp +++ b/src/V3SplitVar.cpp @@ -174,8 +174,10 @@ class SplitUnpackedVarVisitor : public AstNVisitor { pragmap->unlinkFrBack()->deleteTree(); VL_DANGLING(vars[i].first); } } - iterateChildren(nodep); - split(); + if (!vars.empty()) { // need to check this module only when split_var pragma exists in this module. + iterateChildren(nodep); + split(); + } m_modp = NULL; } virtual void visit(AstVarRef* nodep) VL_OVERRIDE { @@ -494,8 +496,10 @@ class SplitPackedVarVisitor : public AstNVisitor { // consume the pragma here anyway. pragmap->unlinkFrBack()->deleteTree(); VL_DANGLING(vars[i].first); } - iterateChildren(nodep); - split(); + if (!vars.empty()) { // need to check this module only when split_var pragma exists in this module. + iterateChildren(nodep); + split(); + } m_modp = NULL; } virtual void visit(AstVarRef* nodep) VL_OVERRIDE {