This patch adds Root Node to the DDG. The purpose of the root node is to create a single entry node that allows graph walk iterators to iterate through all nodes of the graph, making sure that no node is left unvisited during a graph walk (eg. SCC or DFS). Once the DDG is fully constructed it will have exactly one root node. Every node in the graph is reachable from the root. The algorithm for connecting the root node is based on depth-first-search that keeps track of visited nodes to try to avoid creating unnecessary edges.
Previous related revisions:
https://reviews.llvm.org/D65350
The algorithm here seems to add redundant edges depending on the iteration order over the node list (for a graph "A -> B", an edge from the root node is added to both if B is visited before A).
Please add some comment lines about how this algorithm works. The way it is written is somewhat confusing. depth_first_ext will always visit N first if not yet in the visited list. This makes I = N is a test for whether N has been visited yet.