mirror of
https://github.com/verilator/verilator.git
synced 2026-09-06 17:01:09 +02:00
Internals: Fix removing nodes in V3Life (#5365)
This commit is contained in:
+3
-5
@@ -46,17 +46,13 @@ class LifeState final {
|
||||
public:
|
||||
VDouble0 m_statAssnDel; // Statistic tracking
|
||||
VDouble0 m_statAssnCon; // Statistic tracking
|
||||
std::vector<AstNode*> m_unlinkps;
|
||||
|
||||
// CONSTRUCTORS
|
||||
LifeState() = default;
|
||||
~LifeState() {
|
||||
V3Stats::addStatSum("Optimizations, Lifetime assign deletions", m_statAssnDel);
|
||||
V3Stats::addStatSum("Optimizations, Lifetime constant prop", m_statAssnCon);
|
||||
for (AstNode* ip : m_unlinkps) VL_DO_DANGLING(ip->unlinkFrBack()->deleteTree(), ip);
|
||||
}
|
||||
// METHODS
|
||||
void pushUnlinkDeletep(AstNode* nodep) { m_unlinkps.push_back(nodep); }
|
||||
};
|
||||
|
||||
//######################################################################
|
||||
@@ -124,6 +120,7 @@ class LifeBlock final {
|
||||
LifeBlock* const m_aboveLifep; // Upper life, or nullptr
|
||||
LifeState* const m_statep; // Current global state
|
||||
bool m_replacedVref = false; // Replaced a variable reference since last clearing
|
||||
VNDeleter m_deleter; // Used to delay deletion of nodes
|
||||
|
||||
public:
|
||||
LifeBlock(LifeBlock* aboveLifep, LifeState* statep)
|
||||
@@ -145,7 +142,8 @@ public:
|
||||
// above our current iteration point.
|
||||
if (debug() > 4) oldassp->dumpTree("- REMOVE/SAMEBLK: ");
|
||||
entp->complexAssign();
|
||||
VL_DO_DANGLING(m_statep->pushUnlinkDeletep(oldassp), oldassp);
|
||||
oldassp->unlinkFrBack();
|
||||
VL_DO_DANGLING(m_deleter.pushDeletep(oldassp), oldassp);
|
||||
++m_statep->m_statAssnDel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user