Disable multi-threading in V3FuncOpt (#6440)

This code is not thread safe. Specifically AstNode constructors are not
thread safe, as they may create entries in the shared Dtype table via
which can be racy.
This commit is contained in:
Geza Lore 2025-09-16 20:23:05 +02:00 committed by GitHub
parent a44907b700
commit b60ad953c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 2 deletions

View File

@ -324,13 +324,12 @@ void V3FuncOpt::funcOptAll(AstNetlist* nodep) {
UINFO(2, __FUNCTION__ << ":"); UINFO(2, __FUNCTION__ << ":");
{ {
const VNUser1InUse user1InUse; const VNUser1InUse user1InUse;
V3ThreadScope threadScope;
for (AstNodeModule *modp = nodep->modulesp(), *nextModp; modp; modp = nextModp) { for (AstNodeModule *modp = nodep->modulesp(), *nextModp; modp; modp = nextModp) {
nextModp = VN_AS(modp->nextp(), NodeModule); nextModp = VN_AS(modp->nextp(), NodeModule);
for (AstNode *stmtp = modp->stmtsp(), *nextStmtp; stmtp; stmtp = nextStmtp) { for (AstNode *stmtp = modp->stmtsp(), *nextStmtp; stmtp; stmtp = nextStmtp) {
nextStmtp = stmtp->nextp(); nextStmtp = stmtp->nextp();
if (AstCFunc* const cfuncp = VN_CAST(stmtp, CFunc)) { if (AstCFunc* const cfuncp = VN_CAST(stmtp, CFunc)) {
threadScope.enqueue([cfuncp]() { FuncOptVisitor::apply(cfuncp); }); FuncOptVisitor::apply(cfuncp);
} }
} }
} }