From: Clifford Wolf Date: Tue, 12 Aug 2014 15:35:22 +0000 (+0200) Subject: Fixed handling of constant-true branches in proc_clean X-Git-Tag: yosys-0.4~277 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d353fc543295db7d6f4b4ba60c2b66a509b3ee2;p=yosys.git Fixed handling of constant-true branches in proc_clean --- diff --git a/passes/proc/proc_clean.cc b/passes/proc/proc_clean.cc index 13be0ddb6..1e3dd9ce7 100644 --- a/passes/proc/proc_clean.cc +++ b/passes/proc/proc_clean.cc @@ -59,7 +59,8 @@ void proc_clean_switch(RTLIL::SwitchRule *sw, RTLIL::CaseRule *parent, bool &did sw->signal = RTLIL::SigSpec(); } - if (sw->cases.size() == 1 && (sw->signal.size() == 0 || sw->cases[0]->compare.empty())) + if (parent->switches.front() == sw && sw->cases.size() == 1 && + (sw->signal.size() == 0 || sw->cases[0]->compare.empty())) { did_something = true; for (auto &action : sw->cases[0]->actions) diff --git a/passes/proc/proc_rmdead.cc b/passes/proc/proc_rmdead.cc index 61844d5eb..fe3532da8 100644 --- a/passes/proc/proc_rmdead.cc +++ b/passes/proc/proc_rmdead.cc @@ -31,7 +31,7 @@ static void proc_rmdead(RTLIL::SwitchRule *sw, int &counter) for (size_t i = 0; i < sw->cases.size(); i++) { - bool is_default = sw->cases[i]->compare.size() == 0 && !pool.empty(); + bool is_default = SIZE(sw->cases[i]->compare) == 0 && (!pool.empty() || SIZE(sw->signal) == 0); for (size_t j = 0; j < sw->cases[i]->compare.size(); j++) { RTLIL::SigSpec sig = sw->cases[i]->compare[j];