`substitute_node`: Should it be allowed to substitute with a dead node?
The quality test (to be more specific, "Test quality improvement of MIG cut rewriting with compatibility graph and NPN4 resynthesis") does not pass anymore after the fix of #560. This is because cut_rewriting_with_compatibility_graph tries to substitute with a dead node and "revive" it. There are a few possible fixes:
- Remove tests for
cut_rewriting_with_compatibility_graph, as we already know this algorithm is buggy and is not recommended to use. - Modify
cut_rewriting_with_compatibility_graphto skip the substitution if the replacement is dead. This will affect the quality ofcut_rewriting_with_compatibility_graph, so the expected number in the quality test will also be modified. Also,is_deadneeds to be implemented forklut_network. - Modify
cut_rewriting_with_compatibility_graphto usesubstitute_nodes. For this,substitute_nodesneeds to be implemented for other network types than AIG. With a quick experiment, this fix also affected the quality ofcut_rewriting_with_compatibility_graph, and ended up in an infinite while loop in"Test quality improvement of cut rewriting with AIG NPN4 resynthesis", meaning that there might be some other problems... - Correctly deal with the case where the new signal is dead in
substitute_nodeto "revive" it. This will affect other networks and algorithms, but also makes sense to some extend. So the question is: should this be allowed?
#567 will fix the issue with the second solution above. However, I will keep this issue open as the other possibilities (especially the last one) could still be discussed.
#586 fixes this issue better with revive_node (last option above). Changes related to cut_rewriting_with_compatibility_graph (including quality test) in #567 has been reverted.