From 88147b01cfa5805a99e1a50b39082e7aac7c8b59 Mon Sep 17 00:00:00 2001 From: Nick Brereton Date: Fri, 26 Jun 2026 17:27:30 -0400 Subject: [PATCH] Rename const pool cache rebuild (#7845) --- src/V3AstNodeOther.h | 4 ++-- src/V3AstNodes.cpp | 2 +- src/V3Dead.cpp | 2 +- .../t/{t_constpool_recache.py => t_opt_constpool_recache.py} | 0 .../t/{t_constpool_recache.v => t_opt_constpool_recache.v} | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename test_regress/t/{t_constpool_recache.py => t_opt_constpool_recache.py} (100%) rename test_regress/t/{t_constpool_recache.v => t_opt_constpool_recache.v} (97%) diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index 666a3ec22..3c25a9992 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -1000,8 +1000,8 @@ public: // this matters, the caller must handle the dtype difference as appropriate. If 'mergeDType' is // false, the returned VarScope will have _->dtypep()->sameTree(initp->dtypep()) return true. AstVarScope* findConst(AstConst* initp, bool mergeDType); - // Rebuild hashes after potential removals - void reCache(); + // Rebuild hashes and missing variable scopes after potential removals + void rebuildVarScopesAndCache(); }; class AstConstraint final : public AstNode { // Constraint diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 1bed8ca18..aba8a9d0f 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -1780,7 +1780,7 @@ AstVarScope* AstConstPool::findConst(AstConst* initp, bool mergeDType) { return varScopep; } -void AstConstPool::reCache() { +void AstConstPool::rebuildVarScopesAndCache() { m_tables.clear(); m_consts.clear(); std::unordered_map varScopeps; diff --git a/src/V3Dead.cpp b/src/V3Dead.cpp index 677f0b2aa..411ec57eb 100644 --- a/src/V3Dead.cpp +++ b/src/V3Dead.cpp @@ -597,7 +597,7 @@ public: // We may have removed some datatypes, cleanup nodep->typeTablep()->repairCache(); VIsCached::clearCacheTree(); // Removing assignments may affect isPure - nodep->constPoolp()->reCache(); + nodep->constPoolp()->rebuildVarScopesAndCache(); } ~DeadVisitor() override { V3Stats::addStatSum("Optimizations, deadified FTasks", m_statFTasksDeadified); diff --git a/test_regress/t/t_constpool_recache.py b/test_regress/t/t_opt_constpool_recache.py similarity index 100% rename from test_regress/t/t_constpool_recache.py rename to test_regress/t/t_opt_constpool_recache.py diff --git a/test_regress/t/t_constpool_recache.v b/test_regress/t/t_opt_constpool_recache.v similarity index 97% rename from test_regress/t/t_constpool_recache.v rename to test_regress/t/t_opt_constpool_recache.v index 3d15431e9..35ca38a27 100644 --- a/test_regress/t/t_constpool_recache.v +++ b/test_regress/t/t_opt_constpool_recache.v @@ -18,7 +18,7 @@ module t; assign idx = cyc[3:0]; // V3Case lowers this to a 512-bit constant-pool lookup table before V3Dead - // calls AstConstPool::reCache(). + // calls AstConstPool::rebuildVarScopesAndCache(). logic [31:0] case_word; always_comb case (idx)