#41 and #161 added the ability to remove unused nodes from the Graph. The logical next step is the ability to remove redundant nodes. This would require two things:
- We need some method to test whether two nodes are equal (or maybe equivalent?), that is that they will always be guaranteed to take the same value. We could also replace the Cython-level function.
- We need a method to transfer successors from one node to another. So probably something like
Graph::transfer_successors(Node* from_ptr, Node* to_ptr) which uses Node::replace_predecessor(...). We need the latter because some nodes keep redundant pointers.
With those two in place, we can check for equality, and in that case transfer the successors. Having done that as much as possible, we then run the Graph::remove_redundant_nodes() function.
#41 and #161 added the ability to remove unused nodes from the
Graph. The logical next step is the ability to remove redundant nodes. This would require two things:Graph::transfer_successors(Node* from_ptr, Node* to_ptr)which usesNode::replace_predecessor(...). We need the latter because some nodes keep redundant pointers.With those two in place, we can check for equality, and in that case transfer the successors. Having done that as much as possible, we then run the
Graph::remove_redundant_nodes()function.