aboutsummaryrefslogtreecommitdiffstats
path: root/passes/opt
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2020-02-28 12:33:55 -0800
committerEddie Hung <eddie@fpgeh.com>2020-02-28 12:33:55 -0800
commitde3e5fcdc6a3775231b303b89c2bbf551aeaaf42 (patch)
tree534adb5252698d6591028cd146c94dcaa32d04ee /passes/opt
parent825b96fdcffedec02b4eaaa5f9c4aee5bfc6942a (diff)
downloadyosys-de3e5fcdc6a3775231b303b89c2bbf551aeaaf42.tar.gz
yosys-de3e5fcdc6a3775231b303b89c2bbf551aeaaf42.tar.bz2
yosys-de3e5fcdc6a3775231b303b89c2bbf551aeaaf42.zip
ystests: fix write_smt2_write_smt2_cyclic_dependency_fail
Diffstat (limited to 'passes/opt')
-rw-r--r--passes/opt/opt_clean.cc22
1 files changed, 11 insertions, 11 deletions
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)