3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 22:23:23 +00:00
This commit is contained in:
George Rennie 2025-06-05 01:43:24 +01:00 committed by GitHub
commit 3db3f4d0da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -737,6 +737,7 @@ struct OptDffWorker
bool run_constbits() { bool run_constbits() {
ModWalker modwalker(module->design, module); ModWalker modwalker(module->design, module);
QuickConeSat qcsat(modwalker); QuickConeSat qcsat(modwalker);
std::vector<RTLIL::Cell*> cells_to_remove;
// Run as a separate sub-pass, so that we don't mutate (non-FF) cells under ModWalker. // Run as a separate sub-pass, so that we don't mutate (non-FF) cells under ModWalker.
bool did_something = false; bool did_something = false;
@ -830,7 +831,7 @@ struct OptDffWorker
if (!removed_sigbits.count(i)) if (!removed_sigbits.count(i))
keep_bits.push_back(i); keep_bits.push_back(i);
if (keep_bits.empty()) { if (keep_bits.empty()) {
module->remove(cell); cells_to_remove.emplace_back(cell);
did_something = true; did_something = true;
continue; continue;
} }
@ -840,6 +841,8 @@ struct OptDffWorker
did_something = true; did_something = true;
} }
} }
for (auto* cell : cells_to_remove)
module->remove(cell);
return did_something; return did_something;
} }
}; };