copapy.backend.canonicalize#
- copapy.backend.canonicalize(roots)#
Rebuild a DAG with all equivalent nodes merged (common subexpression elimination). The identity of each node is looked up in an id table.
The given DAG is not changed: nodes are copied if their arguments are replaced, otherwise the nodes and nets are reused. In the returned DAG each node has exactly one result net.