abc9: fix memory leak
authorEddie Hung <eddie@fpgeh.com>
Fri, 10 Jan 2020 18:46:06 +0000 (10:46 -0800)
committerEddie Hung <eddie@fpgeh.com>
Fri, 10 Jan 2020 18:46:06 +0000 (10:46 -0800)
passes/techmap/abc9.cc

index 8cb34e52313c0e18ef3c65ba284d2a39c8e58900..3fc6ed2c224314458ea37d58f421aead29de72a1 100644 (file)
@@ -416,13 +416,11 @@ void abc9_module(RTLIL::Design *design, RTLIL::Module *module, std::string scrip
 
                dict<IdString, bool> abc9_box;
                vector<RTLIL::Cell*> boxes;
-               for (auto it = module->cells_.begin(); it != module->cells_.end(); ) {
-                       auto cell = it->second;
+               for (auto cell : module->cells().to_vector()) {
                        if (cell->type.in(ID($_AND_), ID($_NOT_), ID($__ABC9_FF_))) {
-                               it = module->cells_.erase(it);
+                               module->remove(cell);
                                continue;
                        }
-                       ++it;
                        RTLIL::Module* box_module = design->module(cell->type);
                        auto jt = abc9_box.find(cell->type);
                        if (jt == abc9_box.end())