Do not use Module::remove() iterator version

This commit is contained in:
Eddie Hung 2019-06-27 15:29:20 -07:00
parent 312c03e4ca
commit a625854ac5
1 changed files with 6 additions and 5 deletions

View File

@ -555,17 +555,18 @@ void abc9_module(RTLIL::Design *design, RTLIL::Module *current_module, std::stri
dict<IdString, bool> abc_box; dict<IdString, bool> abc_box;
vector<RTLIL::Cell*> boxes; vector<RTLIL::Cell*> boxes;
for (auto cell : module->cells()) { for (const auto &it : module->cells_) {
auto cell = it.second;
if (cell->type.in("$_AND_", "$_NOT_")) { if (cell->type.in("$_AND_", "$_NOT_")) {
module->remove(cell); module->remove(cell);
continue; continue;
} }
auto it = abc_box.find(cell->type); auto jt = abc_box.find(cell->type);
if (it == abc_box.end()) { if (jt == abc_box.end()) {
RTLIL::Module* box_module = design->module(cell->type); RTLIL::Module* box_module = design->module(cell->type);
it = abc_box.insert(std::make_pair(cell->type, box_module && box_module->attributes.count("\\abc_box_id"))).first; jt = abc_box.insert(std::make_pair(cell->type, box_module && box_module->attributes.count("\\abc_box_id"))).first;
} }
if (it->second) if (jt->second)
boxes.emplace_back(cell); boxes.emplace_back(cell);
} }