mirror of
https://github.com/verilator/verilator.git
synced 2026-09-03 16:28:53 +02:00
Fix inlining of CFuncs with reloop locals (#7132)
The recent V3InlineCFuncs only checks AstCFunc::varsp for locals, but V3Reloop used to insert them into AstCFunc::stmtsp resulting in multiple locals with the same name being inlined into the caller if the stars align. Fix Reloop. Such things will also go away with #6280.
This commit is contained in:
+2
-2
@@ -68,6 +68,7 @@ class ReloopVisitor final : public VNVisitor {
|
||||
const string newvarname{"__Vilp" + std::to_string(cfuncp->user1Inc() + 1)};
|
||||
AstVar* const varp
|
||||
= new AstVar{fl, VVarType::STMTTEMP, newvarname, VFlagLogicPacked{}, 32};
|
||||
cfuncp->addVarsp(varp);
|
||||
return varp;
|
||||
}
|
||||
void mergeEnd() {
|
||||
@@ -105,8 +106,7 @@ class ReloopVisitor final : public VNVisitor {
|
||||
AstLoop* const loopp = new AstLoop{fl};
|
||||
loopp->addStmtsp(new AstLoopTest{fl, loopp, condp});
|
||||
initp->addNext(loopp);
|
||||
itp->AstNode::addNext(initp);
|
||||
bodyp->replaceWith(itp);
|
||||
bodyp->replaceWith(initp);
|
||||
loopp->addStmtsp(bodyp);
|
||||
loopp->addStmtsp(incp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user