Revert "hierarchy: fix cache usage by caching false too"

This reverts commit ae14b5e6a8.
This commit is contained in:
Catherine 2026-08-05 16:52:14 +00:00
parent 1410a14345
commit b89dc992e5
1 changed files with 14 additions and 20 deletions

View File

@ -684,30 +684,24 @@ void hierarchy_clean(RTLIL::Design *design, RTLIL::Module *top, bool purge_lib)
bool set_keep_print(std::map<RTLIL::Module*, bool> &cache, RTLIL::Module *mod) bool set_keep_print(std::map<RTLIL::Module*, bool> &cache, RTLIL::Module *mod)
{ {
auto it = cache.find(mod); if (cache.count(mod) == 0)
if (it != cache.end()) for (auto c : mod->cells()) {
return it->second; RTLIL::Module *m = mod->design->module(c->type);
cache[mod] = false; if ((m != nullptr && set_keep_print(cache, m)) || c->type == ID($print))
for (auto c : mod->cells()) { return cache[mod] = true;
RTLIL::Module *m = mod->design->module(c->type); }
if ((m != nullptr && set_keep_print(cache, m)) || c->type == ID($print)) return cache[mod];
return cache[mod] = true;
}
return false;
} }
bool set_keep_assert(std::map<RTLIL::Module*, bool> &cache, RTLIL::Module *mod) bool set_keep_assert(std::map<RTLIL::Module*, bool> &cache, RTLIL::Module *mod)
{ {
auto it = cache.find(mod); if (cache.count(mod) == 0)
if (it != cache.end()) for (auto c : mod->cells()) {
return it->second; RTLIL::Module *m = mod->design->module(c->type);
cache[mod] = false; if ((m != nullptr && set_keep_assert(cache, m)) || c->type.in(ID($check), ID($assert), ID($assume), ID($live), ID($fair), ID($cover)))
for (auto c : mod->cells()) { return cache[mod] = true;
RTLIL::Module *m = mod->design->module(c->type); }
if ((m != nullptr && set_keep_assert(cache, m)) || c->type.in(ID($check), ID($assert), ID($assume), ID($live), ID($fair), ID($cover))) return cache[mod];
return cache[mod] = true;
}
return false;
} }
int find_top_mod_score(Design *design, Module *module, dict<Module*, int> &db) int find_top_mod_score(Design *design, Module *module, dict<Module*, int> &db)