From: Eddie Hung Date: Fri, 28 Feb 2020 20:33:55 +0000 (-0800) Subject: ystests: fix write_smt2_write_smt2_cyclic_dependency_fail X-Git-Tag: working-ls180~782^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=de3e5fcdc6a3775231b303b89c2bbf551aeaaf42;p=yosys.git ystests: fix write_smt2_write_smt2_cyclic_dependency_fail --- diff --git a/passes/opt/opt_clean.cc b/passes/opt/opt_clean.cc index f5bb40050..cac265a52 100644 --- a/passes/opt/opt_clean.cc +++ b/passes/opt/opt_clean.cc @@ -51,18 +51,18 @@ struct keep_cache_t if (cache.count(module)) return cache.at(module); - bool found_keep = false; - if (module->get_bool_attribute(ID::keep)) - found_keep = true; - else - for (auto cell : module->cells()) - if (query(cell, true /* ignore_specify */)) { - found_keep = true; - break; - } - cache[module] = found_keep; + cache[module] = true; + if (!module->get_bool_attribute(ID::keep)) { + bool found_keep = false; + for (auto cell : module->cells()) + if (query(cell, true /* ignore_specify */)) { + found_keep = true; + break; + } + cache[module] = found_keep; + } - return found_keep; + return cache[module]; } bool query(Cell *cell, bool ignore_specify = false)