Internals: Move CReset under Assign (#6978)

This commit is contained in:
Wilson Snyder
2026-01-31 21:27:36 -05:00
committed by GitHub
parent d9234501e0
commit 07ce0ac2ea
11 changed files with 1042 additions and 1004 deletions
+5 -3
View File
@@ -649,9 +649,11 @@ class TaskVisitor final : public VNVisitor {
if (portp->needsCReset() && portp->lifetime().isAutomatic()
&& !portp->valuep()) {
// Reset automatic var to its default, on each invocation of function
AstVarRef* const vrefp
= new AstVarRef{portp->fileline(), portp, VAccess::WRITE};
portp->replaceWith(new AstCReset{portp->fileline(), vrefp, false});
AstNode* const crstp = new AstAssign{
portp->fileline(),
new AstVarRef{portp->fileline(), portp, VAccess::WRITE},
new AstCReset{portp->fileline(), portp, false}};
portp->replaceWith(crstp);
} else {
portp->unlinkFrBack();
}