Fixed performance problem in opt_mux with nets driven by many conflicting drivers
authorClifford Wolf <clifford@clifford.at>
Wed, 19 Mar 2014 09:05:01 +0000 (10:05 +0100)
committerClifford Wolf <clifford@clifford.at>
Wed, 19 Mar 2014 09:05:01 +0000 (10:05 +0100)
passes/opt/opt_muxtree.cc

index 47100869c27dfdb0b080b4720d259e1118d8b7d5..3292a46c8420a7d3b153295ef0a7e648c45b33f0 100644 (file)
@@ -309,13 +309,17 @@ struct OptMuxtreeWorker
                if (port_idx < int(muxinfo.ports.size())-1 && !muxinfo.ports[port_idx].const_activated)
                        knowledge.known_active.push_back(muxinfo.ports[port_idx].ctrl_sigs);
 
+               std::vector<int> parent_muxes;
                for (int m : muxinfo.ports[port_idx].input_muxes) {
                        if (knowledge.visited_muxes.count(m) > 0)
                                continue;
                        knowledge.visited_muxes.insert(m);
+                       parent_muxes.push_back(m);
+               }
+               for (int m : parent_muxes)
                        eval_mux(knowledge, m);
+               for (int m : parent_muxes)
                        knowledge.visited_muxes.erase(m);
-               }
 
                if (port_idx < int(muxinfo.ports.size())-1 && !muxinfo.ports[port_idx].const_activated)
                        knowledge.known_active.pop_back();
@@ -393,6 +397,7 @@ struct OptMuxtreeWorker
        void eval_root_mux(int mux_idx)
        {
                knowledge_t knowledge;
+               knowledge.visited_muxes.insert(mux_idx);
                eval_mux(knowledge, mux_idx);
        }
 };