From 7c1de4464600a1966e18447141f0a20db76ce716 Mon Sep 17 00:00:00 2001 From: wsxarcher Date: Fri, 3 Jul 2026 17:30:58 +0200 Subject: [PATCH] Fix PR review suggestions --- src/V3Fork.cpp | 15 ++++++++------- src/V3LinkDot.cpp | 9 ++------- src/V3LinkJump.cpp | 9 ++------- src/V3Timing.cpp | 15 ++++++++------- test_regress/t/t_disable_begin_instances.py | 2 +- test_regress/t/t_disable_fork_deep.py | 2 +- test_regress/t/t_disable_fork_hier_inst.py | 2 +- test_regress/t/t_disable_fork_instances.py | 2 +- test_regress/t/t_disable_fork_join.py | 2 +- test_regress/t/t_disable_fork_reentrant.py | 2 +- 10 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/V3Fork.cpp b/src/V3Fork.cpp index 27ff282a3..8ee9452cc 100644 --- a/src/V3Fork.cpp +++ b/src/V3Fork.cpp @@ -593,14 +593,15 @@ class ForkVisitor final : public VNVisitor { const AstConst* const constp = VN_CAST(delayp->lhsp(), Const); return constp && (constp->toUQuad() == std::numeric_limits::max()); } - static bool isDisableProcessQueueExpr(const AstNode* const nodep) { - const AstVar* varp = nullptr; - if (const AstVarRef* const refp = VN_CAST(nodep, VarRef)) { - varp = refp->varp(); - } else if (const AstMemberSel* const selp = VN_CAST(nodep, MemberSel)) { - varp = selp->varp(); + static bool isDisableProcessQueueExpr(const AstNodeExpr* const nodep) { + const AstNode* const basep + = AstArraySel::baseFromp(const_cast(nodep), false); + if (const AstVarRef* const refp = VN_CAST(basep, VarRef)) + return refp->varp()->processQueue(); + if (const AstMemberSel* const selp = VN_CAST(basep, MemberSel)) { + return selp->varp() && selp->varp()->processQueue(); } - return varp && varp->processQueue(); + return false; } static bool isDisableQueuePushSelfStmt(const AstNode* const nodep) { // Detect LinkJump-generated registration: diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index e2ba8bc71..2f06855fd 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -96,13 +96,9 @@ static string extractDottedPath(AstNode* nodep, bool& hasPartSelect) { } return ""; } -static AstNode* parentNodep(AstNode* nodep) { - while (nodep && nodep->backp() && nodep->backp()->nextp() == nodep) nodep = nodep->backp(); - return nodep ? nodep->backp() : nullptr; -} static string lexicalDisablePath(AstNode* const targetp) { std::vector names; - for (AstNode* curp = targetp; curp; curp = parentNodep(curp)) { + for (AstNode* curp = targetp; curp; curp = curp->aboveLoopp()) { if (AstNodeBlock* const blockp = VN_CAST(curp, NodeBlock)) { if (blockp->name() != "") names.push_back(blockp->name()); } else if (AstNodeFTask* const ftaskp = VN_CAST(curp, NodeFTask)) { @@ -6210,8 +6206,7 @@ class LinkDotResolveVisitor final : public VNVisitor { pushDeletep(nodep->unlinkFrBack()); } if (nodep->targetp()) { - AstNodeExpr* oldRefp = nodep->targetRefp()->unlinkFrBack(); - VL_DO_DANGLING(oldRefp->deleteTree(), oldRefp); + nodep->targetRefp()->unlinkFrBack()->deleteTree(); if (!hasPartSelect) { const string instancePath = targetInstancePath(nodep->targetp(), targetPath); if (instancePath != "") { diff --git a/src/V3LinkJump.cpp b/src/V3LinkJump.cpp index ccca50d95..22020ce0e 100644 --- a/src/V3LinkJump.cpp +++ b/src/V3LinkJump.cpp @@ -168,12 +168,8 @@ class LinkJumpVisitor final : public VNVisitor { } return false; } - static AstNode* parentNodep(AstNode* nodep) { - while (nodep && nodep->backp() && nodep->backp()->nextp() == nodep) nodep = nodep->backp(); - return nodep ? nodep->backp() : nullptr; - } static AstNodeModule* findOwnerModulep(AstNode* nodep) { - for (AstNode* curp = nodep; curp; curp = parentNodep(curp)) { + for (AstNode* curp = nodep; curp; curp = curp->aboveLoopp()) { if (AstNodeModule* const modp = VN_CAST(curp, NodeModule)) return modp; } return nullptr; @@ -239,8 +235,7 @@ class LinkJumpVisitor final : public VNVisitor { killQueueCall->classOrPackagep(v3Global.rootp()->stdPackageProcessp()); return new AstStmtExpr{fl, killQueueCall}; } - template - static void prependStmtsp(T_Node* const nodep, AstNode* const stmtp) { + static void prependStmtsp(AstBegin* const nodep, AstNode* const stmtp) { if (AstNode* const origStmtsp = nodep->stmtsp()) { origStmtsp->unlinkFrBackWithNext(); stmtp->addNext(origStmtsp); diff --git a/src/V3Timing.cpp b/src/V3Timing.cpp index cd69e29af..2da6485f5 100644 --- a/src/V3Timing.cpp +++ b/src/V3Timing.cpp @@ -749,14 +749,15 @@ class TimingControlVisitor final : public VNVisitor { addDebugInfo(donep); beginp->addStmtsp(donep->makeStmt()); } - static bool isDisableProcessQueueExpr(const AstNode* const nodep) { - const AstVar* varp = nullptr; - if (const AstVarRef* const refp = VN_CAST(nodep, VarRef)) { - varp = refp->varp(); - } else if (const AstMemberSel* const selp = VN_CAST(nodep, MemberSel)) { - varp = selp->varp(); + static bool isDisableProcessQueueExpr(const AstNodeExpr* const nodep) { + const AstNode* const basep + = AstArraySel::baseFromp(const_cast(nodep), false); + if (const AstVarRef* const refp = VN_CAST(basep, VarRef)) + return refp->varp()->processQueue(); + if (const AstMemberSel* const selp = VN_CAST(basep, MemberSel)) { + return selp->varp() && selp->varp()->processQueue(); } - return varp && varp->processQueue(); + return false; } static bool hasDisableQueuePushSelfPrefix(const AstBegin* const beginp) { // LinkJump prepends disable-by-name registration as: diff --git a/test_regress/t/t_disable_begin_instances.py b/test_regress/t/t_disable_begin_instances.py index fdbd25744..6fe7d000c 100755 --- a/test_regress/t/t_disable_begin_instances.py +++ b/test_regress/t/t_disable_begin_instances.py @@ -11,7 +11,7 @@ import vltest_bootstrap test.scenarios('simulator') -test.compile(verilator_flags2=["--binary", "-Wno-ZERODLY"]) +test.compile(verilator_flags2=["--binary"]) test.execute() diff --git a/test_regress/t/t_disable_fork_deep.py b/test_regress/t/t_disable_fork_deep.py index fdbd25744..6fe7d000c 100755 --- a/test_regress/t/t_disable_fork_deep.py +++ b/test_regress/t/t_disable_fork_deep.py @@ -11,7 +11,7 @@ import vltest_bootstrap test.scenarios('simulator') -test.compile(verilator_flags2=["--binary", "-Wno-ZERODLY"]) +test.compile(verilator_flags2=["--binary"]) test.execute() diff --git a/test_regress/t/t_disable_fork_hier_inst.py b/test_regress/t/t_disable_fork_hier_inst.py index fdbd25744..6fe7d000c 100755 --- a/test_regress/t/t_disable_fork_hier_inst.py +++ b/test_regress/t/t_disable_fork_hier_inst.py @@ -11,7 +11,7 @@ import vltest_bootstrap test.scenarios('simulator') -test.compile(verilator_flags2=["--binary", "-Wno-ZERODLY"]) +test.compile(verilator_flags2=["--binary"]) test.execute() diff --git a/test_regress/t/t_disable_fork_instances.py b/test_regress/t/t_disable_fork_instances.py index fdbd25744..6fe7d000c 100755 --- a/test_regress/t/t_disable_fork_instances.py +++ b/test_regress/t/t_disable_fork_instances.py @@ -11,7 +11,7 @@ import vltest_bootstrap test.scenarios('simulator') -test.compile(verilator_flags2=["--binary", "-Wno-ZERODLY"]) +test.compile(verilator_flags2=["--binary"]) test.execute() diff --git a/test_regress/t/t_disable_fork_join.py b/test_regress/t/t_disable_fork_join.py index fdbd25744..6fe7d000c 100755 --- a/test_regress/t/t_disable_fork_join.py +++ b/test_regress/t/t_disable_fork_join.py @@ -11,7 +11,7 @@ import vltest_bootstrap test.scenarios('simulator') -test.compile(verilator_flags2=["--binary", "-Wno-ZERODLY"]) +test.compile(verilator_flags2=["--binary"]) test.execute() diff --git a/test_regress/t/t_disable_fork_reentrant.py b/test_regress/t/t_disable_fork_reentrant.py index fdbd25744..6fe7d000c 100755 --- a/test_regress/t/t_disable_fork_reentrant.py +++ b/test_regress/t/t_disable_fork_reentrant.py @@ -11,7 +11,7 @@ import vltest_bootstrap test.scenarios('simulator') -test.compile(verilator_flags2=["--binary", "-Wno-ZERODLY"]) +test.compile(verilator_flags2=["--binary"]) test.execute()