Do not feed any empty logic into scheduling (#4972)

This commit is contained in:
Geza Lore 2024-03-16 10:35:56 +00:00 committed by GitHub
parent 08c76b1da6
commit 878204db73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 9 deletions

View File

@ -77,6 +77,21 @@ class ActiveTopVisitor final : public VNVisitor {
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
return;
}
// Delete empty procedures
for (AstNode *stmtp = nodep->stmtsp(), *nextp; stmtp; stmtp = nextp) {
nextp = stmtp->nextp();
if (AstNodeProcedure* const procp = VN_CAST(stmtp, NodeProcedure)) {
if (!procp->stmtsp()) VL_DO_DANGLING(pushDeletep(procp->unlinkFrBack()), stmtp);
}
}
// Delete empty actives
if (!nodep->stmtsp()) {
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
return;
}
// Move the SENTREE for each active up to the global level.
// This way we'll easily see what clock domains are identical
AstSenTree* const wantp = m_finder.getSenTree(sensesp);

View File

@ -116,7 +116,8 @@ public:
AstNode* const headp = [&]() -> AstNode* {
if (!procp) return logicp; // Not a procedure, handle as a unit
AstNode* const stmtsp = procp->stmtsp();
if (stmtsp) stmtsp->unlinkFrBackWithNext();
UASSERT_OBJ(stmtsp, procp, "Empty process should have been deleted earlier");
stmtsp->unlinkFrBackWithNext();
// Procedure is no longer needed and can be deleted right now
VL_DO_DANGLING(procp->deleteTree(), procp);
return stmtsp;

View File

@ -355,14 +355,9 @@ LogicClasses gatherLogicClasses(AstNetlist* netlistp) {
LogicClasses result;
netlistp->foreach([&](AstScope* scopep) {
std::vector<AstActive*> empty;
scopep->foreach([&](AstActive* activep) {
AstSenTree* const senTreep = activep->sensesp();
if (!activep->stmtsp()) {
// Some AstActives might be empty due to previous optimizations
empty.push_back(activep);
} else if (senTreep->hasStatic()) {
if (senTreep->hasStatic()) {
UASSERT_OBJ(!senTreep->sensesp()->nextp(), activep,
"static initializer with additional sensitivities");
result.m_static.emplace_back(scopep, activep);
@ -393,8 +388,6 @@ LogicClasses gatherLogicClasses(AstNetlist* netlistp) {
}
}
});
for (AstActive* const activep : empty) activep->unlinkFrBack()->deleteTree();
});
return result;